From: Antoine Pitrou Date: Fri, 15 Jul 2011 19:01:21 +0000 (+0200) Subject: Issue #11321: Fix a crash with multiple imports of the _pickle module when X-Git-Tag: v3.2.2rc1~110^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8391cf4e1d73683795e51ac5ce8ee9e61eea389d;p=thirdparty%2FPython%2Fcpython.git Issue #11321: Fix a crash with multiple imports of the _pickle module when embedding Python. Patch by Andreas Stührk. --- diff --git a/Misc/NEWS b/Misc/NEWS index 18ee9d30b2f0..215439377605 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 e13d8742ca18..287f0a3c15af 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;