summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_importlib/test_util.py
Commit message (Collapse)AuthorAgeFilesLines
* GH-126606: don't write incomplete pyc files (GH-126627)CF Bolz-Tereick2024-11-131-0/+32
| | | | Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru> Co-authored-by: Brett Cannon <brett@python.org>
* gh-76785: Rename _xxsubinterpreters to _interpreters (gh-117791)Eric Snow2024-04-241-1/+1
| | | See https://discuss.python.org/t/pep-734-multiple-interpreters-in-the-stdlib/41147/26.
* gh-117649: Raise ImportError for unsupported modules in free-threaded build ↵Sam Gross2024-04-111-0/+4
| | | | | | | | | | (#117651) The free-threaded build does not currently support the combination of single-phase init modules and non-isolated subinterpreters. Ensure that `check_multi_interp_extensions` is always `True` for subinterpreters in the free-threaded build so that importing these modules raises an `ImportError`.
* gh-76785: Consolidate Some Interpreter-related Testing Helpers (gh-117485)Eric Snow2024-04-021-2/+2
| | | This eliminates the duplication of functionally identical helpers in the _testinternalcapi and _xxsubinterpreters modules.
* gh-114099 - Add iOS framework loading machinery. (GH-116454)Russell Keith-Magee2024-03-191-2/+9
| | | | Co-authored-by: Malcolm Smith <smith@chaquo.com> Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
* GH-115979: update test_importlib to work under WASI SDK 21 (GH-116754)Brett Cannon2024-03-131-1/+1
|
* gh-76785: Fixes for test.support.interpreters (gh-112982)Eric Snow2023-12-121-2/+14
| | | This involves a number of changes for PEP 734.
* gh-76785: Return an "excinfo" Object From Interpreter.run() (gh-111573)Eric Snow2023-11-231-14/+8
|
* gh-105873: Make `_xxsubinterpreters` use exception type name in shared ↵Radislav Chugunov2023-07-081-1/+1
| | | | exception (#105874)
* gh-104310: Rename the New Function in importlib.util (gh-105255)Eric Snow2023-06-081-13/+13
| | | | | | | | | | | The original name wasn't as clear as it could have been. This change includes the following: * rename the function * change the default value for "disable_check" to False * add clues to the docstring that folks should probably not use the function --------- Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
* gh-104310: Add importlib.util.allowing_all_extensions() (gh-104311)Eric Snow2023-05-081-0/+121
| | | (I'll be adding docs for this separately.)
* gh-97850: Remove deprecated functions from `importlib.utils` (#97898)Nikita Sobolev2022-10-071-178/+0
| | | | | * gh-97850: Remove deprecated functions from `importlib.utils` * Rebase and remove `set_package` from diff
* gh-65961: Raise `DeprecationWarning` when `__package__` differs from ↵Brett Cannon2022-10-051-63/+0
| | | | | | | `__spec__.parent` (#97879) Also remove `importlib.util.set_package()` which was already slated for removal. Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
* Update the magic number in test_util.py (#95714)Pablo Galindo Salgado2022-08-051-1/+1
|
* bpo-46425: fix direct invocation of `test_importlib` (GH-30682)Nikita Sobolev2022-01-221-1/+2
|
* bpo-43672: raise ImportWarning when calling find_loader() (GH-25119)Brett Cannon2021-04-021-16/+14
|
* bpo-37830: Fix compilation of break and continue in finally. (GH-15320)Serhiy Storchaka2019-08-241-1/+1
| | | | | | Fix compilation of "break" and "continue" in the "finally" block when the corresponding "try" block contains "return" with a non-constant value.
* bpo-37444: Update differing exception between builtins and importlib (GH-14869)Ngalim Siregar2019-08-031-3/+3
| | | | | | | | | | Imports now raise `TypeError` instead of `ValueError` for relative import failures. This makes things consistent between `builtins.__import__` and `importlib.__import__` as well as using a more natural import for the failure. https://bugs.python.org/issue37444 Automerge-Triggered-By: @brettcannon
* Remove unused imports in tests (GH-14518)Victor Stinner2019-07-011-1/+0
|
* bpo-36540: PEP 570 -- Implementation (GH-12701)Pablo Galindo2019-04-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit contains the implementation of PEP570: Python positional-only parameters. * Update Grammar/Grammar with new typedarglist and varargslist * Regenerate grammar files * Update and regenerate AST related files * Update code object * Update marshal.c * Update compiler and symtable * Regenerate importlib files * Update callable objects * Implement positional-only args logic in ceval.c * Regenerate frozen data * Update standard library to account for positional-only args * Add test file for positional-only args * Update other test files to account for positional-only args * Add News entry * Update inspect module and related tests
* bpo-36680: Rename duplicate test_source_from_cache_path_like_arg function ↵Windson yang2019-04-221-1/+1
| | | | (GH-12893)
* bpo-29514: Make magic number test work for candidatesNed Deily2018-06-271-1/+1
|
* bpo-33499: Add PYTHONPYCACHEPREFIX env var for alt bytecode cache location. ↵Carl Meyer2018-06-161-11/+84
| | | | | | | | | | | | | | | (GH-6834) In some development setups it is inconvenient or impossible to write bytecode caches to the code tree, but the bytecode caches are still useful. The PYTHONPYCACHEPREFIX environment variable allows specifying an alternate location for cached bytecode files, within which a directory tree mirroring the code tree will be created. This cache tree is then used (for both reading and writing) instead of the local `__pycache__` subdirectory within each source directory. Exposed at runtime as sys.pycache_prefix (defaulting to None), and can be set from the CLI as "-X pycache_prefix=path". Patch by Carl Meyer.
* bpo-17611. Move unwinding of stack for "pseudo exceptions" from interpreter ↵Serhiy Storchaka2018-02-221-1/+1
| | | | | | | | | to compiler. (GH-5006) Co-authored-by: Mark Shannon <mark@hotpy.org> Co-authored-by: Antoine Pitrou <antoine@python.org>
* bpo-30436: Raise ModuleNotFoundError for importlib.util.find_spec() when ↵Milan Oberkirch2017-06-141-0/+6
| | | | | parent isn't a package (GH-1899) Previously AttributeError was raised, but that's not very reflective of the fact that the requested module can't be found since the specified parent isn't actually a package.
* bpo-29514: Check magic number for bugfix release (#54)Eric Appelt2017-04-171-0/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * bpo-29514: Check magic number for micro release Add a dict importlib.util.EXPECTED_MAGIC_NUMBERS which details the initial and expected pyc magic number for each minor release. This gives a mechanism for users to check if the magic number has changed within a release and for a test to ensure procedure is followed if a change is necessary. Add a test to check the current MAGIC_NUMBER against the expected number for the release if the current release is at candidate or final level. On test failure, describe to the developer the procedure for changing the magic number. * Simplify magic number release test Simplify the magic number release test by removing EXPECTED_MAGIC_NUMBERS table and making the expected magic number self-contained within the test. BPO: 29514 * Improve magic number test execution and message Improve the execution of the magic number test by using skipUnless for alpha and beta releases, and directly inheriting from unittest.TestCase rather than using the machinery for the other tests. Also improve the error message to explain the reason for caution in changing the magic number. BPO: 29514
* Issue #28026: Raise ImportError when exec_module() exists but ↵Eric Snow2016-09-081-7/+1
| | | | create_module() is missing.
* Issue #26667: Add path-like object support to importlib.util.Brett Cannon2016-09-081-0/+19
|
* Issue #27895: Spelling fixes (Contributed by Ville Skyttä).Raymond Hettinger2016-08-301-1/+1
|
* Issue #23731: Implement PEP 488.Brett Cannon2015-04-131-18/+96
| | | | | | The concept of .pyo files no longer exists. Now .pyc files have an optional `opt-` tag which specifies if any extra optimizations beyond the peepholer were applied.
* Remove a dead test for a never-launched APIBrett Cannon2015-03-271-9/+0
|
* Issue #23014: Make importlib.abc.Loader.create_module() required whenBrett Cannon2015-01-091-3/+9
| | | | | | | | | importlib.abc.Loader.exec_module() is also defined. Before this change, create_module() was optional **and** could return None to trigger default semantics. This change now reduces the options for choosing default semantics to one and in the most backporting-friendly way (define create_module() to return None).
* Issue #20383: Introduce importlib.util.module_from_spec().Brett Cannon2014-05-301-37/+115
| | | | | | Along the way, dismantle importlib._bootstrap._SpecMethods as it was no longer relevant and constructing the new function required partially dismantling the class anyway.
* Issue #21503: Use test_both() consistently in test_importlib.Eric Snow2014-05-161-41/+44
|
* Issue 19944: Fix importlib.find_spec() so it imports parents as needed.Eric Snow2014-01-251-0/+147
| | | | The function is also moved to importlib.util.
* Issue 19713: Add PEP 451-related deprecations.Eric Snow2014-01-071-8/+18
|
* Implement PEP 451 (ModuleSpec).Eric Snow2013-11-221-65/+0
|
* Issue #16803: Move test_importlib.test_util to use both frozen andBrett Cannon2013-10-181-50/+85
| | | | source code.
* Issue #18076: Introduce imoportlib.util.decode_source().Brett Cannon2013-06-161-0/+21
| | | | | | | The helper function makes it easier to implement imoprtlib.abc.InspectLoader.get_source() by making that function require just the raw bytes for source code and handling all other details.
* Issue #17177: stop using imp in test_importlibBrett Cannon2013-06-151-15/+15
|
* Issue #17907: touch up the code for imp.new_module().Brett Cannon2013-06-151-0/+116
|
* Issue #18192: Introduce importlib.util.MAGIC_NUMBER and document theBrett Cannon2013-06-141-0/+11
| | | | deprecation of imp.get_magic().
* Issues #18088, 18089: IntroduceBrett Cannon2013-05-311-5/+19
| | | | | | | | | | | | | | | | | | | | | importlib.abc.Loader.init_module_attrs() and implement importlib.abc.InspectLoader.load_module(). The importlib.abc.Loader.init_module_attrs() method sets the various attributes on the module being loaded. It is done unconditionally to support reloading. Typically people used importlib.util.module_for_loader, but since that's a decorator there was no way to override it's actions, so init_module_attrs() came into existence to allow for overriding. This is also why module_for_loader is now pending deprecation (having its other use replaced by importlib.util.module_to_load). All of this allowed for importlib.abc.InspectLoader.load_module() to be implemented. At this point you can now implement a loader with nothing more than get_code() (which only requires get_source(); package support requires is_package()). Thanks to init_module_attrs() the implementation of load_module() is basically a context manager containing 2 methods calls, a call to exec(), and a return statement.
* Add a reset_name argument to importlib.util.module_to_load in order toBrett Cannon2013-05-311-0/+12
| | | | | control whether to reset the module's __name__ attribute in case a reload is being done.
* Rename importlib.util.ModuleManager to module_to_load so that the nameBrett Cannon2013-05-301-7/+7
| | | | explains better what the context manager is providing.
* Issue #18070: importlib.util.module_for_loader() now sets __loader__Brett Cannon2013-05-281-1/+12
| | | | | and __package__ unconditionally in order to do the right thing for reloading.
* Introduce importlib.util.ModuleManager which is a context manager toBrett Cannon2013-05-281-0/+50
| | | | | | | | handle providing (and cleaning up if needed) the module to be loaded. A future commit will use the context manager in Lib/importlib/_bootstrap.py and thus why the code is placed there instead of in Lib/importlib/util.py.
* Issue #17117: Have both import itself and importlib.util.set_loader()Brett Cannon2013-03-131-10/+32
| | | | | | set __loader__ on a module when set to None. Thanks to Gökcen Eraslan for the fix.
* Issue #15168: Move importlb.test to test.test_importlib.Brett Cannon2012-07-201-0/+208
This should make the Linux distros happy as it is now easier to leave importlib's tests out of their base Python distribution.