diff options
author | Christian Heimes <christian@cheimes.de> | 2008-01-03 22:16:32 (GMT) |
---|---|---|
committer | Christian Heimes <christian@cheimes.de> | 2008-01-03 22:16:32 (GMT) |
commit | 000a074c955a1964959ee908300ef49b41170a06 (patch) | |
tree | af32b732d8b3285969bd524a4af25b6533adbb4c /Include | |
parent | 0a83d79268e9d2b36decc78845cf71baced4ccc6 (diff) | |
download | cpython-000a074c955a1964959ee908300ef49b41170a06.zip cpython-000a074c955a1964959ee908300ef49b41170a06.tar.gz cpython-000a074c955a1964959ee908300ef49b41170a06.tar.bz2 |
Modified PyImport_Import and PyImport_ImportModule to always use absolute imports by calling __import__ with an explicit level of 0
Added a new API function PyImport_ImportModuleNoBlock. It solves the problem with dead locks when mixing threads and imports
Diffstat (limited to 'Include')
-rw-r--r-- | Include/import.h | 5 | ||||
-rw-r--r-- | Include/py_curses.h | 2 |
2 files changed, 2 insertions, 5 deletions
diff --git a/Include/import.h b/Include/import.h index af9f339..05ad7f0 100644 --- a/Include/import.h +++ b/Include/import.h @@ -14,13 +14,10 @@ PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleEx( PyAPI_FUNC(PyObject *) PyImport_GetModuleDict(void); PyAPI_FUNC(PyObject *) PyImport_AddModule(const char *name); PyAPI_FUNC(PyObject *) PyImport_ImportModule(const char *name); +PyAPI_FUNC(PyObject *) PyImport_ImportModuleNoBlock(const char *); PyAPI_FUNC(PyObject *) PyImport_ImportModuleLevel(char *name, PyObject *globals, PyObject *locals, PyObject *fromlist, int level); -/* For DLL compatibility */ -#undef PyImport_ImportModuleEx -PyAPI_FUNC(PyObject *) PyImport_ImportModuleEx( - char *name, PyObject *globals, PyObject *locals, PyObject *fromlist); #define PyImport_ImportModuleEx(n, g, l, f) \ PyImport_ImportModuleLevel(n, g, l, f, -1) diff --git a/Include/py_curses.h b/Include/py_curses.h index b045a59..f38f765 100644 --- a/Include/py_curses.h +++ b/Include/py_curses.h @@ -90,7 +90,7 @@ static void **PyCurses_API; #define import_curses() \ { \ - PyObject *module = PyImport_ImportModule("_curses"); \ + PyObject *module = PyImport_ImportModuleNoBlock("_curses"); \ if (module != NULL) { \ PyObject *module_dict = PyModule_GetDict(module); \ PyObject *c_api_object = PyDict_GetItemString(module_dict, "_C_API"); \ |