Commit Graph

15 Commits

Author SHA1 Message Date
Jeong, YunWon
470bd5990b Fix test_import: import machinery, circular imports, and script shadowing (#7034)
* Fix test_import: import machinery and errors

- Emit IMPORT_FROM instead of LOAD_ATTR for `import a.b.c as m`
- Add "partially initialized module" error for circular imports
- Add "cannot access submodule" error for initializing submodules
- Implement script shadowing detection with "consider renaming" hint
  - Detect user scripts shadowing stdlib/third-party modules
  - Compute original sys.path[0] from sys.argv[0]
  - Check sys.stdlib_module_names for stdlib detection
  - Respect safe_path setting
- Implement _imp._fix_co_filename for code source_path rewriting
- Add data parameter to _imp.get_frozen_object with marshal deser
- Fix import_from: check __spec__.has_location before using origin
- Set ImportError.path attribute on import failures
- Fix import_star error messages for non-str __all__/__dict__ items
- Always call builtins.__import__ in import_inner

* Propagate __bool__ errors from fromlist in import

Previously, try_to_bool errors were silently swallowed via .ok(),
causing fromlist with broken __bool__ to default to false.
2026-02-09 01:40:26 +09:00
CPython Developers
afdf8cefe8 Update importlib from v3.14.2 2026-02-05 00:21:34 +09:00
Ashwin Naren
b4f0a589ed platform-dependent Windows testing (#5536)
* disable test_argparse on windows

* fix test_exceptions and mark it as platform dependent

* test importlib on windows

* explain why windows tests fail

* mark test_argparse as non platform-independent

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
2025-02-23 09:48:02 +09:00
Jeong, YunWon
af884cb284 First step for Python 3.12 support (#5078)
* Mark 3.12

* Update importlib from Python 3.12.0

* Update test_importlib from Python3.12

* Mark failings tests from importlib

* Update test.support from Python3.12

* Fix unsupported parser feature

* mark failing test

* Update functools from Python 3.12

* manual type annotation

* slice behavior changed in 3.12

* empty unittest.main returns non-zero

* test_decimal from CPython 3.12

* Mark failing tests

* Update test_unicode from CPython 3.12

* Update test_functools from Python 3.12

* Update enum from Python 3.12

* enum

* Doc format changed

* Update test_module from CPython

---------

Co-authored-by: CPython developers <>
2023-10-22 19:19:05 -07:00
Jeong YunWon
7492b46c43 mark success/fail tests for test_import 2023-02-25 22:59:57 +09:00
CPython Developers
496006d629 Update importlib from CPython 3.11.2 2023-02-25 22:59:57 +09:00
CPython Developers
da109336bb Update importlib/test_importlib from CPython 3.10.6 2022-08-18 03:22:20 +09:00
Padraic Fanning
69df285a82 Unskip tests in frozen.test_loader 2021-02-25 17:18:33 -05:00
Padraic Fanning
7de448fa78 Explain test_is_package skip 2021-02-07 15:49:41 -05:00
Padraic Fanning
76538ee1bf Explain test_lacking_parent skip 2021-02-07 15:49:41 -05:00
Padraic Fanning
57c700b0fb Explain test_package skip 2021-02-07 15:49:41 -05:00
Padraic Fanning
4d1c844d4d Explain test_lacking_parent skip 2021-02-07 15:49:41 -05:00
Padraic Fanning
7584d1d100 Explain test_package skip 2021-02-07 15:49:41 -05:00
Aviv Palivoda
f039959480 Mark unsupported py_compile tests 2020-07-18 17:04:35 +03:00
Aviv Palivoda
e6d413b30b Add test_importlib from CPython 3.8 2020-07-18 17:04:35 +03:00