Bartosz Sławecki
a66d51876d
gh-145334: Make lazy import tests discoverable ( #145336 )
2026-02-28 01:44:50 +00:00
Filipe Laíns
56b7dc4e9b
Fix compileall in lazy imports test data with bad syntax ( #145221 )
2026-02-25 16:27:53 +00:00
Filipe Laíns
80b2b88338
Fix "lazy from (...) import (...)" tests ( #145213 )
2026-02-25 15:57:06 +00:00
Pablo Galindo Salgado
46d5106cfa
gh-142349: Implement PEP 810 - Explicit lazy imports ( #142351 )
...
Co-authored-by: T. Wouters <twouters@meta.com >
Co-authored-by: Brittany Reynoso <breynoso@meta.com>
Co-authored-by: Dino Viehland <dinoviehland@meta.com>
2026-02-12 00:15:33 +00:00
Brett Cannon
af185727b2
GH-65961: Stop setting __cached__ on modules (GH-142165)
2025-12-11 11:44:46 -08:00
Serhiy Storchaka
6826166280
gh-135801: Improve filtering by module in warn_explicit() without module argument (GH-140151)
...
* Try to match the module name pattern with module names constructed
starting from different parent directories of the filename.
E.g., for "/path/to/package/module" try to match with
"path.to.package.module", "to.package.module", "package.module" and
"module".
* Ignore trailing "/__init__.py".
* Ignore trailing ".pyw" on Windows.
* Keep matching with the full filename (without optional ".py" extension)
for compatibility.
* Only ignore the case of the ".py" extension on Windows.
2025-10-30 15:55:39 +02:00
Petr Viktorin
aee219f455
gh-123880: Allow recursive import of single-phase-init modules (GH-123950)
...
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
Co-authored-by: Brett Cannon <brett@python.org>
2024-09-20 10:27:34 +02:00
Serhiy Storchaka
c0eaa232f6
gh-117860: Add tests for resolving names when import rebind names (GH-118176)
...
Add tests for "import", pkgutil.resolve_name() and unittest.mock.path()
for cases when "import a.b as x" and "from a import b as x" give
different results.
2024-04-30 17:23:44 +03:00
Shantanu
61e8184095
gh-95754: Better AttributeError on partially initialised module ( #112577 )
...
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-12-21 13:24:10 -08:00
Nikita Sobolev
0738b9a338
gh-108303: Move double_const to test_import where it belongs ( #112108 )
2023-12-11 19:29:43 +01:00
Filipe Laíns
0a8ae8a50a
bpo-44717: improve AttributeError on circular imports of submodules (GH-27338)
2021-07-24 23:44:46 +01:00
Pablo Galindo Salgado
3eae8f20d7
Revert "bpo-44717: improve AttributeError on circular imports of submodules (GH-27299)" (GH-27331)
...
This reverts commit 8072a1181d .
2021-07-24 14:33:03 +01:00
Filipe Laíns
8072a1181d
bpo-44717: improve AttributeError on circular imports of submodules (GH-27299)
...
Signed-off-by: Filipe Laíns <lains@riseup.net>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-07-24 11:50:17 +02:00
Dino Viehland
9b6fec4651
bpo-39336: Allow packages to not let their child modules be set on them ( #18006 )
...
* bpo-39336: Allow setattr to fail on modules which aren't assignable
When attaching a child module to a package if the object in sys.modules raises an AttributeError (e.g. because it is immutable) it causes the whole import to fail. This now allows immutable packages to exist and an ImportWarning is reported and the AttributeError exception is ignored.
2020-01-22 16:42:38 -08:00
Anthony Sottile
65366bc8bd
bpo-20490: Improve circular import error message (GH-15308)
2019-09-09 08:17:50 -07:00
Serhiy Storchaka
3e429dcc24
bpo-33237: Improve AttributeError message for partially initialized module. (GH-6398)
2018-10-30 13:19:51 +02:00
Serhiy Storchaka
8a9cd20edc
bpo-30876: Relative import from unloaded package now reimports the package ( #2639 )
...
instead of failing with SystemError.
Relative import from non-package now fails with ImportError rather than
SystemError.
2017-07-12 06:50:03 +03:00
Serhiy Storchaka
b4baacee1a
bpo-30814: Fixed a race condition when import a submodule from a package. ( #2580 )
2017-07-06 08:09:03 +03:00
Serhiy Storchaka
f93234bb8a
bpo-30024: Circular imports involving absolute imports with binding ( #1264 )
...
a submodule to a name are now supported.
2017-05-09 22:31:05 +03:00
Antoine Pitrou
44fff77684
Whitespace
2014-10-13 20:21:12 +02:00
Antoine Pitrou
0373a106a1
Issue #17636 : Circular imports involving relative imports are now supported.
2014-10-13 20:19:45 +02:00