Mercurial > cpython-lru_cache-weakref
comparison Python/errors.c @ 44439:0cbe94bea2c7 legacy-trunk
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
| author | Christian Heimes <christian@cheimes.de> |
|---|---|
| date | Thu, 03 Jan 2008 22:16:32 +0000 |
| parents | 3bc3f12cae28 |
| children | 840064802952 |
comparison
equal
deleted
inserted
replaced
| 44438:27e4e530cf2f | 44439:0cbe94bea2c7 |
|---|---|
| 688 const char *filename, int lineno, | 688 const char *filename, int lineno, |
| 689 const char *module, PyObject *registry) | 689 const char *module, PyObject *registry) |
| 690 { | 690 { |
| 691 PyObject *mod, *dict, *func = NULL; | 691 PyObject *mod, *dict, *func = NULL; |
| 692 | 692 |
| 693 mod = PyImport_ImportModule("warnings"); | 693 mod = PyImport_ImportModuleNoBlock("warnings"); |
| 694 if (mod != NULL) { | 694 if (mod != NULL) { |
| 695 dict = PyModule_GetDict(mod); | 695 dict = PyModule_GetDict(mod); |
| 696 func = PyDict_GetItemString(dict, "warn_explicit"); | 696 func = PyDict_GetItemString(dict, "warn_explicit"); |
| 697 Py_DECREF(mod); | 697 Py_DECREF(mod); |
| 698 } | 698 } |
