[Python-checkins] cpython (3.2): Issue #11321: Fix a crash with multiple imports of the _pickle module when

antoine.pitrou python-checkins at python.org
Fri Jul 15 21:03:24 CEST 2011


http://hg.python.org/cpython/rev/1ae0b7b8de0b
changeset:   71347:1ae0b7b8de0b
branch:      3.2
parent:      71345:a19e99625c8a
user:        Antoine Pitrou <solipsis at pitrou.net>
date:        Fri Jul 15 21:01:21 2011 +0200
summary:
  Issue #11321: Fix a crash with multiple imports of the _pickle module when
embedding Python.  Patch by Andreas Stührk.

files:
  Misc/NEWS         |  3 +++
  Modules/_pickle.c |  2 ++
  2 files changed, 5 insertions(+), 0 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -27,6 +27,9 @@
 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
--- a/Modules/_pickle.c
+++ b/Modules/_pickle.c
@@ -6321,8 +6321,10 @@
     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;
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list