diff options
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/cPickle.c | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/Modules/cPickle.c b/Modules/cPickle.c index c131e9e..ba453a9 100644 --- a/Modules/cPickle.c +++ b/Modules/cPickle.c @@ -824,70 +824,6 @@ put2(Picklerobject *self, PyObject *ob) return res; } -#define PyImport_Import cPickle_Import - -static PyObject * -PyImport_Import(PyObject *module_name) -{ - static PyObject *silly_list=0, *__builtins___str=0, *__import___str; - static PyObject *standard_builtins=0; - PyObject *globals=0, *__import__=0, *__builtins__=0, *r=0; - - if (!( silly_list )) { - if (!( __import___str=PyString_FromString("__import__"))) - return NULL; - if (!( __builtins___str=PyString_FromString("__builtins__"))) - return NULL; - if (!( silly_list=Py_BuildValue("[s]","__doc__"))) - return NULL; - } - - if ((globals=PyEval_GetGlobals())) { - Py_INCREF(globals); - __builtins__=PyObject_GetItem(globals,__builtins___str); - if (!__builtins__) - goto err; - } - else { - PyErr_Clear(); - - if (!(standard_builtins || - (standard_builtins=PyImport_ImportModule("__builtin__")))) - return NULL; - - __builtins__=standard_builtins; - Py_INCREF(__builtins__); - globals = Py_BuildValue("{sO}", "__builtins__", __builtins__); - if (!globals) - goto err; - } - - if (PyDict_Check(__builtins__)) { - __import__=PyObject_GetItem(__builtins__,__import___str); - if (!__import__) goto err; - } - else { - __import__=PyObject_GetAttr(__builtins__,__import___str); - if (!__import__) goto err; - } - - r=PyObject_CallFunction(__import__,"OOOO", - module_name, globals, globals, silly_list); - if (!r) - goto err; - - Py_DECREF(globals); - Py_DECREF(__builtins__); - Py_DECREF(__import__); - - return r; - err: - Py_XDECREF(globals); - Py_XDECREF(__builtins__); - Py_XDECREF(__import__); - return NULL; -} - static PyObject * whichmodule(PyObject *global, PyObject *global_name) { |