From 9470ab43a9804928275b0a2a0860a2028af854db Mon Sep 17 00:00:00 2001 From: Antoine Pitrou Date: Fri, 15 Jul 2011 20:25:20 +0200 Subject: Make sure to reap worker threads and processes at the end of test_concurrent_futures --- Lib/test/test_concurrent_futures.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/Lib/test/test_concurrent_futures.py b/Lib/test/test_concurrent_futures.py index 2662af7..6cc57f8 100644 --- a/Lib/test/test_concurrent_futures.py +++ b/Lib/test/test_concurrent_futures.py @@ -598,16 +598,20 @@ class FutureTests(unittest.TestCase): self.assertTrue(isinstance(f1.exception(timeout=5), IOError)) +@test.support.reap_threads def test_main(): - test.support.run_unittest(ProcessPoolExecutorTest, - ThreadPoolExecutorTest, - ProcessPoolWaitTests, - ThreadPoolWaitTests, - ProcessPoolAsCompletedTests, - ThreadPoolAsCompletedTests, - FutureTests, - ProcessPoolShutdownTest, - ThreadPoolShutdownTest) + try: + test.support.run_unittest(ProcessPoolExecutorTest, + ThreadPoolExecutorTest, + ProcessPoolWaitTests, + ThreadPoolWaitTests, + ProcessPoolAsCompletedTests, + ThreadPoolAsCompletedTests, + FutureTests, + ProcessPoolShutdownTest, + ThreadPoolShutdownTest) + finally: + test.support.reap_children() if __name__ == "__main__": test_main() -- cgit v0.12 From 8391cf4e1d73683795e51ac5ce8ee9e61eea389d Mon Sep 17 00:00:00 2001 From: Antoine Pitrou Date: Fri, 15 Jul 2011 21:01:21 +0200 Subject: =?UTF-8?q?Issue=20#11321:=20Fix=20a=20crash=20with=20multiple=20i?= =?UTF-8?q?mports=20of=20the=20=5Fpickle=20module=20when=20embedding=20Pyt?= =?UTF-8?q?hon.=20=20Patch=20by=20Andreas=20St=C3=BChrk.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Misc/NEWS | 3 +++ Modules/_pickle.c | 2 ++ 2 files changed, 5 insertions(+) diff --git a/Misc/NEWS b/Misc/NEWS index 18ee9d3..2154393 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -27,6 +27,9 @@ Core and Builtins Library ------- +- Issue #11321: Fix a crash with multiple imports of the _pickle module when + embedding Python. Patch by Andreas Stührk. + - Issue #12502: asyncore: fix polling loop with AF_UNIX sockets. - Issue #4376: ctypes now supports nested structures in a endian different than diff --git a/Modules/_pickle.c b/Modules/_pickle.c index e13d874..287f0a3 100644 --- a/Modules/_pickle.c +++ b/Modules/_pickle.c @@ -6321,8 +6321,10 @@ PyInit__pickle(void) if (m == NULL) return NULL; + Py_INCREF(&Pickler_Type); if (PyModule_AddObject(m, "Pickler", (PyObject *)&Pickler_Type) < 0) return NULL; + Py_INCREF(&Unpickler_Type); if (PyModule_AddObject(m, "Unpickler", (PyObject *)&Unpickler_Type) < 0) return NULL; -- cgit v0.12