mirror of
https://github.com/python/cpython.git
synced 2026-04-15 00:00:57 +00:00
gh-148110: Resolve lazy import filter names for relative imports (#148111)
This commit is contained in:
parent
a0c57a8d17
commit
ca960b6f38
7 changed files with 197 additions and 8 deletions
4
Python/clinic/sysmodule.c.h
generated
4
Python/clinic/sysmodule.c.h
generated
|
|
@ -1830,7 +1830,7 @@ PyDoc_STRVAR(sys_set_lazy_imports_filter__doc__,
|
|||
"would otherwise be enabled. Returns True if the import is still enabled\n"
|
||||
"or False to disable it. The callable is called with:\n"
|
||||
"\n"
|
||||
"(importing_module_name, imported_module_name, [fromlist])\n"
|
||||
"(importing_module_name, resolved_imported_module_name, [fromlist])\n"
|
||||
"\n"
|
||||
"Pass None to clear the filter.");
|
||||
|
||||
|
|
@ -2121,4 +2121,4 @@ exit:
|
|||
#ifndef SYS_GETANDROIDAPILEVEL_METHODDEF
|
||||
#define SYS_GETANDROIDAPILEVEL_METHODDEF
|
||||
#endif /* !defined(SYS_GETANDROIDAPILEVEL_METHODDEF) */
|
||||
/*[clinic end generated code: output=adbadb629b98eabf input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=e8333fe10c01ae66 input=a9049054013a1b77]*/
|
||||
|
|
|
|||
|
|
@ -4523,7 +4523,7 @@ _PyImport_LazyImportModuleLevelObject(PyThreadState *tstate,
|
|||
assert(!PyErr_Occurred());
|
||||
fromlist = Py_NewRef(Py_None);
|
||||
}
|
||||
PyObject *args[] = {modname, name, fromlist};
|
||||
PyObject *args[] = {modname, abs_name, fromlist};
|
||||
PyObject *res = PyObject_Vectorcall(filter, args, 3, NULL);
|
||||
|
||||
Py_DECREF(modname);
|
||||
|
|
|
|||
|
|
@ -2796,14 +2796,14 @@ The filter is a callable which disables lazy imports when they
|
|||
would otherwise be enabled. Returns True if the import is still enabled
|
||||
or False to disable it. The callable is called with:
|
||||
|
||||
(importing_module_name, imported_module_name, [fromlist])
|
||||
(importing_module_name, resolved_imported_module_name, [fromlist])
|
||||
|
||||
Pass None to clear the filter.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
sys_set_lazy_imports_filter_impl(PyObject *module, PyObject *filter)
|
||||
/*[clinic end generated code: output=10251d49469c278c input=2eb48786bdd4ee42]*/
|
||||
/*[clinic end generated code: output=10251d49469c278c input=fd51ed8df6ab54b7]*/
|
||||
{
|
||||
if (PyImport_SetLazyImportsFilter(filter) < 0) {
|
||||
return NULL;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue