From 8391cf4e1d73683795e51ac5ce8ee9e61eea389d Mon Sep 17 00:00:00 2001 From: Antoine Pitrou Date: Fri, 15 Jul 2011 21:01:21 +0200 Subject: [PATCH] =?utf8?q?Issue=20#11321:=20Fix=20a=20crash=20with=20multi?= =?utf8?q?ple=20imports=20of=20the=20=5Fpickle=20module=20when=20embedding?= =?utf8?q?=20Python.=20=20Patch=20by=20Andreas=20St=C3=BChrk.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 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 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; -- 2.47.3