summaryrefslogtreecommitdiffstats
path: root/Modules/cPickle.c
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2003-02-13 22:17:05 (GMT)
committerTim Peters <tim.peters@gmail.com>2003-02-13 22:17:05 (GMT)
commitaae53d47d6950ec868dc7c83f6fb020ca41c2522 (patch)
tree1caba39f9064f171f6d2f99e2136cb5b7d35b964 /Modules/cPickle.c
parent4b499dd3fb49181efbd99f87e45ff923146cba8a (diff)
downloadcpython-aae53d47d6950ec868dc7c83f6fb020ca41c2522.zip
cpython-aae53d47d6950ec868dc7c83f6fb020ca41c2522.tar.gz
cpython-aae53d47d6950ec868dc7c83f6fb020ca41c2522.tar.bz2
The version of PyImport_Import() in cPickle is no longer needed (an edited
version was moved into import.c long ago), so squashed the duplication.
Diffstat (limited to 'Modules/cPickle.c')
-rw-r--r--Modules/cPickle.c64
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)
{