]> granicus.if.org Git - python/commitdiff
Simple fix from Jin Fulton to avoid returning a half-initialized
authorGuido van Rossum <guido@python.org>
Thu, 7 Sep 2000 00:11:40 +0000 (00:11 +0000)
committerGuido van Rossum <guido@python.org>
Thu, 7 Sep 2000 00:11:40 +0000 (00:11 +0000)
module when e.g. copy_reg.py doesn't exist.  This caused a core dump.

This closes SF bug 112944.

Modules/cPickle.c

index b64b1f137799a8bc3f75f6aebefaffcb02a00e29..7161c2e413e0eae7a850f691b5b57193866ed667 100644 (file)
@@ -4521,6 +4521,8 @@ initcPickle(void) {
     PyObject *format_version;
     PyObject *compatible_formats;
 
+    if (init_stuff(m, d) < 0) return;
+
     Picklertype.ob_type = &PyType_Type;
     Unpicklertype.ob_type = &PyType_Type;
     PdataType.ob_type = &PyType_Type;
@@ -4542,6 +4544,4 @@ initcPickle(void) {
     PyDict_SetItemString(d, "compatible_formats", compatible_formats);
     Py_XDECREF(format_version);
     Py_XDECREF(compatible_formats);
-
-    init_stuff(m, d);
 }