pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/python/cpython/pull/148111.patch

""", + } + + result = self._assert_subprocess_ok( + """ + import pkg.runner + print("OK") + """, + files, + ) + self.assertIn("OK", result.stdout) + class AdditionalSyntaxRestrictionTests(unittest.TestCase): """Additional syntax restriction tests per PEP 810.""" diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2026-04-04-22-20-00.gh-issue-148110.cL5x2Q.rst b/Misc/NEWS.d/next/Core_and_Builtins/2026-04-04-22-20-00.gh-issue-148110.cL5x2Q.rst new file mode 100644 index 00000000000000..dc7df0e4a299c9 --- /dev/null +++ b/Misc/NEWS.d/next/Core_and_Builtins/2026-04-04-22-20-00.gh-issue-148110.cL5x2Q.rst @@ -0,0 +1,2 @@ +Fix :func:`sys.set_lazy_imports_filter` so relative lazy imports pass the +resolved imported module name to the filter callback. Patch by Pablo Galindo. diff --git a/Python/clinic/sysmodule.c.h b/Python/clinic/sysmodule.c.h index f8ae7f18acc809..dd603ae6668a3a 100644 --- a/Python/clinic/sysmodule.c.h +++ b/Python/clinic/sysmodule.c.h @@ -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."); diff --git a/Python/import.c b/Python/import.c index e298fbee536c1b..7aa96196ec1e10 100644 --- a/Python/import.c +++ b/Python/import.c @@ -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); diff --git a/Python/sysmodule.c b/Python/sysmodule.c index ce9c03bda7bd57..6298b080a0269f 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -2796,7 +2796,7 @@ 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]*/ From 6ec1b79cd3093a095d06dadfeea6c5083b2bbfc1 Mon Sep 17 00:00:00 2001 From: Pablo Galindo Salgado Date: Sun, 5 Apr 2026 20:43:25 +0100 Subject: [PATCH 2/2] fixup! Merge branch 'main' into lazy-stuff --- Python/clinic/sysmodule.c.h | 2 +- Python/sysmodule.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Python/clinic/sysmodule.c.h b/Python/clinic/sysmodule.c.h index dd603ae6668a3a..86e942ec2b8afb 100644 --- a/Python/clinic/sysmodule.c.h +++ b/Python/clinic/sysmodule.c.h @@ -2121,4 +2121,4 @@ _jit_is_active(PyObject *module, PyObject *Py_UNUSED(ignored)) #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]*/ diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 6298b080a0269f..408d04684a9193 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -2803,7 +2803,7 @@ Pass None to clear the filter. 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; pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy