diff options
Diffstat (limited to 'Python')
-rw-r--r-- | Python/import.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Python/import.c b/Python/import.c index 7301fcc..f2b30af 100644 --- a/Python/import.c +++ b/Python/import.c @@ -556,6 +556,23 @@ import_find_extension(PyThreadState *tstate, PyObject *name, return mod; } +PyObject * +_PyImport_FindExtensionObject(PyObject *name, PyObject *filename) +{ + PyThreadState *tstate = _PyThreadState_GET(); + PyObject *mod = import_find_extension(tstate, name, filename); + if (mod) { + PyObject *ref = PyWeakref_NewRef(mod, NULL); + Py_DECREF(mod); + if (ref == NULL) { + return NULL; + } + mod = PyWeakref_GetObject(ref); + Py_DECREF(ref); + } + return mod; /* borrowed reference */ +} + /* Get the module object corresponding to a module name. First check the modules dictionary if there's one there, |