diff -Nurp python2/fix_issue_17703.patch python2/fix_issue_17703.patch --- python2/fix_issue_17703.patch 1970-01-01 01:00:00.000000000 +0100 +++ python2/fix_issue_17703.patch 2013-04-29 11:24:30.843128655 +0200 @@ -0,0 +1,39 @@ + +# HG changeset patch +# User Antoine Pitrou +# Date 1366053614 -7200 +# Node ID e814fbd470bf42d84c5148e8ac876e68a7a7e8da +# Parent 6a4746b0afaf93800e80ab61b776eff32a7df827 +Issue #17703: Fix a regression where an illegal use of Py_DECREF() after interpreter finalization can cause a crash. + +diff --git a/Include/object.h b/Include/object.h +--- a/Include/object.h ++++ b/Include/object.h +@@ -984,16 +984,22 @@ PyAPI_FUNC(void) _PyTrash_thread_destroy + + #define PyTrash_UNWIND_LEVEL 50 + ++/* Note the workaround for when the thread state is NULL (issue #17703) */ + #define Py_TRASHCAN_SAFE_BEGIN(op) \ + do { \ + PyThreadState *_tstate = PyThreadState_GET(); \ +- if (_tstate->trash_delete_nesting < PyTrash_UNWIND_LEVEL) { \ +- ++_tstate->trash_delete_nesting; ++ if (!_tstate || \ ++ _tstate->trash_delete_nesting < PyTrash_UNWIND_LEVEL) { \ ++ if (_tstate) \ ++ ++_tstate->trash_delete_nesting; + /* The body of the deallocator is here. */ + #define Py_TRASHCAN_SAFE_END(op) \ +- --_tstate->trash_delete_nesting; \ +- if (_tstate->trash_delete_later && _tstate->trash_delete_nesting <= 0) \ +- _PyTrash_thread_destroy_chain(); \ ++ if (_tstate) { \ ++ --_tstate->trash_delete_nesting; \ ++ if (_tstate->trash_delete_later \ ++ && _tstate->trash_delete_nesting <= 0) \ ++ _PyTrash_thread_destroy_chain(); \ ++ } \ + } \ + else \ + _PyTrash_thread_deposit_object((PyObject*)op); \ diff -Nurp python2/PKGBUILD python2/PKGBUILD --- python2/PKGBUILD 2013-04-29 00:06:20.000000000 +0200 +++ python2/PKGBUILD 2013-04-29 11:23:29.067387409 +0200 @@ -5,7 +5,7 @@ pkgname=python2 pkgver=2.7.4 -pkgrel=1 +pkgrel=2 _pybasever=2.7 pkgdesc="A high-level scripting language" arch=('i686' 'x86_64') @@ -16,12 +16,19 @@ makedepends=('tk>=8.6.0' 'bluez') optdepends=('tk: for IDLE') conflicts=('python<3') options=('!makeflags') -source=(http://www.python.org/ftp/python/${pkgver%rc?}/Python-${pkgver}.tar.xz) -sha1sums=('08e78ebeb6d9c799644f6d787ca424291c0fe03e') +source=(http://www.python.org/ftp/python/${pkgver%rc?}/Python-${pkgver}.tar.xz + 'fix_issue_17703.patch') +sha1sums=('08e78ebeb6d9c799644f6d787ca424291c0fe03e' + 'eed4dae87ae2456f7fa636ad0826b4d8622598e0') build() { cd "${srcdir}/Python-${pkgver}" + # fix regression in python2 2.7.4 + # bug: http://bugs.python.org/issue17703 + # hg commit with fix: http://hg.python.org/cpython/rev/e814fbd470bf + patch -Np1 < ${srcdir}/fix_issue_17703.patch + # Temporary workaround for FS#22322 # See http://bugs.python.org/issue10835 for upstream report sed -i "/progname =/s/python/python${_pybasever}/" Python/pythonrun.c