Mercurial > cpython-lru_cache-weakref
diff Python/import.c @ 17264:6393f55dbd7b 2.0
- Importing should now be safe with multiple Py_Initialize/Py_Finalize
sequences.
| author | Moshe Zadka <moshez@math.huji.ac.il> |
|---|---|
| date | Fri, 30 Mar 2001 19:45:13 +0000 |
| parents | 5d41ca49a10a |
| children |
line wrap: on
line diff
--- a/Python/import.c Fri Mar 30 19:18:23 2001 +0000 +++ b/Python/import.c Fri Mar 30 19:45:13 2001 +0000 @@ -1842,7 +1842,6 @@ static PyObject *silly_list = NULL; static PyObject *builtins_str = NULL; static PyObject *import_str = NULL; - static PyObject *standard_builtins = NULL; PyObject *globals = NULL; PyObject *import = NULL; PyObject *builtins = NULL; @@ -1873,15 +1872,10 @@ /* No globals -- use standard builtins, and fake globals */ PyErr_Clear(); - if (standard_builtins == NULL) { - standard_builtins = - PyImport_ImportModule("__builtin__"); - if (standard_builtins == NULL) - return NULL; - } - - builtins = standard_builtins; - Py_INCREF(builtins); + builtins = PyImport_ImportModuleEx("__builtin__", + NULL, NULL, NULL); + if (builtins == NULL) + return NULL; globals = Py_BuildValue("{OO}", builtins_str, builtins); if (globals == NULL) goto err;
