[pypy-commit] pypy cpyext-PyThreadState_New: Move a bad DECREF, and add a call to PyThreadState_Clear(), my tests still crash.

amauryfa noreply at buildbot.pypy.org
Sat Sep 29 08:28:34 CEST 2012


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: cpyext-PyThreadState_New
Changeset: r57659:cd71beb7aa2a
Date: 2012-09-29 08:27 +0200
http://bitbucket.org/pypy/pypy/changeset/cd71beb7aa2a/

Log:	Move a bad DECREF, and add a call to PyThreadState_Clear(), my tests
	still crash.

diff --git a/pypy/module/cpyext/test/callback_in_thread.c b/pypy/module/cpyext/test/callback_in_thread.c
--- a/pypy/module/cpyext/test/callback_in_thread.c
+++ b/pypy/module/cpyext/test/callback_in_thread.c
@@ -29,6 +29,12 @@
     else
 	Py_DECREF(result);
 
+    Py_DECREF(data->callback);
+
+    /* XXX Python examples don't mention it, but docs say that
+     * PyThreadState_Delete requires it. */
+    PyThreadState_Clear(tstate);
+
     /* Release the thread. No Python API allowed beyond this point. */
     PyEval_ReleaseThread(tstate);
 
@@ -36,7 +42,6 @@
        until you need it the next time. */
     PyThreadState_Delete(tstate);
 
-    Py_DECREF(data->callback);
     free(data);
     return NULL;
 }


More information about the pypy-commit mailing list