]> granicus.if.org Git - python/commitdiff
Update a comment about why the __module__ can sometime be NULL.
authorAlexandre Vassalotti <alexandre@peadrop.com>
Fri, 3 Apr 2009 04:17:41 +0000 (04:17 +0000)
committerAlexandre Vassalotti <alexandre@peadrop.com>
Fri, 3 Apr 2009 04:17:41 +0000 (04:17 +0000)
Initialize last_string and arg member of Unpickler.

Modules/_pickle.c

index 4976cc5d5c1f425047f1871de8411452f3c3e43d..bda8efdf0441f2990652e475ee62516acdd820bc 100644 (file)
@@ -691,9 +691,9 @@ whichmodule(PyObject *global, PyObject *global_name)
 
     module_name = PyObject_GetAttr(global, module_str);
 
-    /* In some rare cases (e.g., random.getrandbits), __module__ can be
-       None. If it is so, then search sys.modules for the module of
-       global.  */
+    /* In some rare cases (e.g., bound methods of extension types),
+       __module__ can be None. If it is so, then search sys.modules
+       for the module of global.  */
     if (module_name == Py_None) {
         Py_DECREF(module_name);
         goto search;
@@ -4447,6 +4447,9 @@ Unpickler_init(UnpicklerObject *self, PyObject *args, PyObject *kwds)
     if (self->memo == NULL)
         return -1;
 
+    self->last_string = NULL;
+    self->arg = NULL;
+
     return 0;
 }