Commit f9f9dbc0 authored by Jim Fulton's avatar Jim Fulton

Fixed reference-counting bug in find_class.

parent 3372ef87
/*
$Id: cPickle.c,v 1.53 1998/05/05 15:41:31 jim Exp $
$Id: cPickle.c,v 1.54 1998/05/08 14:41:15 jim Exp $
Copyright
......@@ -55,7 +55,7 @@
static char cPickle_module_documentation[] =
"C implementation and optimization of the Python pickle module\n"
"\n"
"$Id: cPickle.c,v 1.53 1998/05/05 15:41:31 jim Exp $\n"
"$Id: cPickle.c,v 1.54 1998/05/08 14:41:15 jim Exp $\n"
;
#include "Python.h"
......@@ -1934,14 +1934,16 @@ find_class(PyObject *py_module_name, PyObject *py_global_name) {
PyObject *global = 0, *module;
UNLESS(module=PySys_GetObject("modules")) return NULL;
UNLESS(module=PyDict_GetItem(module, py_module_name)) {
if(module=PyDict_GetItem(module, py_module_name)) {
global=PyObject_GetAttr(module, py_global_name);
}
else {
PyErr_Clear();
UNLESS(module=PyImport_Import(py_module_name)) return NULL;
global=PyObject_GetAttr(module, py_global_name);
Py_DECREF(module);
}
global=PyObject_GetAttr(module, py_global_name);
Py_DECREF(module);
return global;
}
......@@ -4258,7 +4260,7 @@ init_stuff(PyObject *module, PyObject *module_dict) {
void
initcPickle() {
PyObject *m, *d, *v;
char *rev="$Revision: 1.53 $";
char *rev="$Revision: 1.54 $";
PyObject *format_version;
PyObject *compatible_formats;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment