summaryrefslogtreecommitdiffstats
path: root/Python/importlib.h
Commit message (Collapse)AuthorAgeFilesLines
* Revert "[3.6] bpo-32303 - Consistency fixes for namespace loaders (GH-5481) ↵Barry Warsaw2018-02-261-946/+945
| | | | | (#5504)" (#5911) This reverts commit a71397fb6603d0fe673acd7765c74699cd28fe7b.
* [3.6] bpo-32303 - Consistency fixes for namespace loaders (GH-5481) (#5504)Barry Warsaw2018-02-031-945/+946
| | | | | | | | | | * Make sure ``__spec__.loader`` matches ``__loader__`` for namespace packages. * Make sure ``__spec__.origin` matches ``__file__`` for namespace packages. https://bugs.python.org/issue32303 https://bugs.python.org/issue32305. (cherry picked from commit bbbcf8693b876daae4469765aa62f8924f39a7d2) Co-authored-by: Barry Warsaw <barry@python.org>
* [3.6] bpo-21720: Restore the Python 2.7 logic in handling a fromlist. ↵Serhiy Storchaka2017-10-261-1583/+1593
| | | | | | | | (GH-4118) (#4128) BytesWarning no longer emitted when the fromlist argument of __import__() or the __all__ attribute of the module contain bytes instances.. (cherry picked from commit 41c56940c6edf3ea169332a6b039b6c8796f0475)
* [3.6] bpo-31642: Restore blocking "from" import by setting None in ↵Serhiy Storchaka2017-10-081-238/+241
| | | | | sys.modules. (GH-3834). (#3923) (cherry picked from commit f07e2b64df6304a36fb5e29397d3c77a7ba17704)
* [3.6] bpo-31070: Fix a race condition in importlib _get_module_lock(). ↵Serhiy Storchaka2017-08-091-1477/+1481
| | | | | (GH-3033). (#3038) (cherry picked from commit 9b0d1d647e3d2ec9d299e5c9f49b02fbbb810a5a)
* bpo-30891: Fix again importlib _find_and_load() (#2665) (#2801)Victor Stinner2017-07-211-341/+342
| | | | | | | | | | Use sys.modules.get() in the "with _ModuleLockManager(name):" block to protect the dictionary key with the module lock and use an atomic get to prevent race condition. Remove also _bootstrap._POPULATE since it was unused (_bootstrap_external now has its own _POPULATE object), add a new _SENTINEL object instead. (cherry picked from commit e72b1359f81d1dd42bd8a5c5cc2b3928b74f8023)
* [3.6] bpo-30876: Relative import from unloaded package now reimports the ↵Serhiy Storchaka2017-07-161-364/+356
| | | | | | | | | package (GH-2639) (#2676) instead of failing with SystemError. Relative import from non-package now fails with ImportError rather than SystemError. (cherry picked from commit 8a9cd20edca7d01b68292036029ae3735ce65edd)
* bpo-30891: Fix importlib _find_and_load() race condition (#2646) (#2651)Victor Stinner2017-07-101-1526/+1518
| | | | | | | * Rewrite importlib _get_module_lock(): it is now responsible to hold the imp lock directly. * _find_and_load() now holds the module lock to check if name is in sys.modules to prevent a race condition (cherry picked from commit 4f9a446f3fb42f800e73cd9414dd1eccb3ca4fa7)
* [3.6] bpo-30814: Fixed a race condition when import a submodule from a ↵Serhiy Storchaka2017-07-061-295/+293
| | | | | package. (GH-2580). (#2598) (cherry picked from commit b4baacee1adc06edbe30ac7574d17a8cd168e2e0)
* Refresh Python/importlib.h and Python/importlib_external.h (#464)Ned Deily2017-03-041-1/+1
|
* Issue #28517: Fixed of-by-one error in the peephole optimizer that causedSerhiy Storchaka2016-10-251-1149/+1147
| | | | keeping unreachable code.
* Issue #27942: String constants now interned recursively in tuples and ↵Serhiy Storchaka2016-09-301-1739/+1737
|\ | | | | | | frozensets.
| * Issue #27942: String constants now interned recursively in tuples and ↵Serhiy Storchaka2016-09-301-66/+65
| | | | | | | | frozensets.
* | Issue #27213: Fixed different issues with reworked CALL_FUNCTION* opcodes.Serhiy Storchaka2016-09-111-1446/+1446
| | | | | | | | | | | | | | | | | | | | | | * BUILD_TUPLE_UNPACK and BUILD_MAP_UNPACK_WITH_CALL no longer generated with single tuple or dict. * Restored more informative error messages for incorrect var-positional and var-keyword arguments. * Removed code duplications in _PyEval_EvalCodeWithName(). * Removed redundant runtime checks and parameters in _PyStack_AsDict(). * Added a workaround and enabled previously disabled test in test_traceback. * Removed dead code from the dis module.
* | Rework CALL_FUNCTION* opcodesVictor Stinner2016-09-091-1445/+1445
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Issue #27213: Rework CALL_FUNCTION* opcodes to produce shorter and more efficient bytecode: * CALL_FUNCTION now only accepts position arguments * CALL_FUNCTION_KW accepts position arguments and keyword arguments, but keys of keyword arguments are packed into a constant tuple. * CALL_FUNCTION_EX is the most generic, it expects a tuple and a dict for positional and keyword arguments. CALL_FUNCTION_VAR and CALL_FUNCTION_VAR_KW opcodes have been removed. 2 tests of test_traceback are currently broken: skip test, the issue #28050 was created to track the issue. Patch by Demur Rumed, design by Serhiy Storchaka, reviewed by Serhiy Storchaka and Victor Stinner.
* | Issue #28026: Raise ImportError when exec_module() exists but ↵Eric Snow2016-09-081-899/+895
| | | | | | | | create_module() is missing.
* | Issue #15767: Use ModuleNotFoundError.Eric Snow2016-09-071-251/+250
| |
* | Issue #27974: Remove importlib._bootstrap._ManageReload.Brett Cannon2016-09-061-1799/+1746
| | | | | | | | Class was dead code. Thanks to Xiang Zhang for the patch.
* | Issue #27078: Added BUILD_STRING opcode. Optimized f-strings evaluation.Serhiy Storchaka2016-09-061-205/+204
| |
* | Update frozen importlib codeBrett Cannon2016-07-081-843/+844
| |
* | Issue #27095: Simplified MAKE_FUNCTION and removed MAKE_CLOSURE opcodes.Serhiy Storchaka2016-06-121-1650/+1652
| | | | | | | | Patch by Demur Rumed.
* | Issue #27076: Merge spelling from 3.5Martin Panter2016-05-261-146/+146
|\ \ | |/
| * Issue #27076: Doc, comment and tests spelling fixesMartin Panter2016-05-261-154/+154
| | | | | | | | Most fixes to Doc/ and Lib/ directories by Ville Skyttä.
* | Issue #26647: Python interpreter now uses 16-bit wordcode instead of bytecode.Serhiy Storchaka2016-05-241-1929/+1790
| | | | | | | | Patch by Demur Rumed.
* | Fix bug in __import__ during Python shutdownVictor Stinner2016-03-241-439/+445
| | | | | | | | | | | | Issue #26637: The importlib module now emits an ImportError rather than a TypeError if __import__() is tried during the Python shutdown process but sys.path is already cleared (set to None).
* | Merge for issue #26367Brett Cannon2016-02-201-393/+398
|\ \ | |/
| * Issue #26367: Have importlib.__init__() raise RuntimeError whenBrett Cannon2016-02-201-370/+371
| | | | | | | | | | | | | | 'level' is specified but no __package__. This brings the function inline with builtins.__import__(). Thanks to Manuel Jacob for the patch.
* | Issue #25791: Warn when __package__ != __spec__.parent.Brett Cannon2016-01-221-54/+63
| | | | | | | | | | | | | | | | | | In a previous change, __spec__.parent was prioritized over __package__. That is a backwards-compatibility break, but we do eventually want __spec__ to be the ground truth for module details. So this change reverts the change in semantics and instead raises an ImportWarning when __package__ != __spec__.parent to give people time to adjust to using spec objects.
* | Issue #25791: Raise an ImportWarning when __spec__ or __package__ areBrett Cannon2016-01-151-273/+286
|/ | | | | | | | not defined for a relative import. This is the start of work to try and clean up import semantics to rely more on a module's spec than on the myriad attributes that get set on a module. Thanks to Rose Ames for the patch.
* Issue #24769: Interpreter now starts properly when dynamic loadingLarry Hastings2015-08-251-1/+1
| | | | is disabled. Patch by Petr Viktorin.
* PEP 489: Multi-phase extension module initializationNick Coghlan2015-05-231-753/+769
| | | | | | | | | | | | | | | | | | | | | | | Known limitations of the current implementation: - documentation changes are incomplete - there's a reference leak I haven't tracked down yet The leak is most visible by running: ./python -m test -R3:3 test_importlib However, you can also see it by running: ./python -X showrefcount Importing the array or _testmultiphase modules, and then deleting them from both sys.modules and the local namespace shows significant increases in the total number of active references each cycle. By contrast, with _testcapi (which continues to use single-phase initialisation) the global refcounts stabilise after a couple of cycles.
* Issue #24192: Fix namespace package imports.Eric Snow2015-05-161-1942/+1942
|
* PEP 0492 -- Coroutines with async and await syntax. Issue #24017.Yury Selivanov2015-05-121-1733/+1733
|
* Issue #23911: Move path-based bootstrap code to a separate frozen module.Eric Snow2015-05-031-4305/+1922
|
* Issue #23731: Implement PEP 488.Brett Cannon2015-04-131-4220/+4281
| | | | | | 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.
* merge 3.4 (#21295)Benjamin Peterson2015-02-021-349/+349
|\
| * revert lineno and col_offset changes from #16795 (closes #21295)Benjamin Peterson2015-02-021-3895/+3895
| |
* | Issue #23014: Make importlib.abc.Loader.create_module() required whenBrett Cannon2015-01-091-2330/+2375
| | | | | | | | | | | | | | | | | | 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).
* | Update Python/importlib.hZachary Ware2014-12-151-3763/+3763
| |
* | - Issue #22966: Fix __pycache__ pyc file name clobber when pyc_compile isBarry Warsaw2014-12-011-3495/+3496
|\ \ | |/ | | | | | | asked to compile a source file containing multiple dots in the source file name.
| * - Issue #22966: Fix __pycache__ pyc file name clobber when pyc_compile isBarry Warsaw2014-12-011-3611/+3612
| | | | | | | | | | asked to compile a source file containing multiple dots in the source file name.
* | Issue #22934: Update the comment to mention Programs/_freeze_importlib.c.Berker Peksag2014-11-241-1/+1
| |
* | Update importlib.hAntoine Pitrou2014-11-231-430/+430
| |
* | Issue #22834: Have import suppress FileNotFoundError when the currentBrett Cannon2014-11-211-998/+1000
| | | | | | | | | | | | working directory no longer exists. Thanks to Martin Panter for the bug report.
* | Issue #21052: Don't raise ImportWarning for sys.meta_path orBrett Cannon2014-10-101-24/+26
| | | | | | | | | | | | sys.path_hooks when set to None during interpreter shutdown. Thanks to Martin Panter for the initial bug report.
* | Update importlib.h frozen bytecode (changed due to commit c0ca9d32aed4).Georg Brandl2014-09-241-3817/+3796
| |
* | Fix a parameter name to make sense againBrett Cannon2014-05-301-3178/+3178
| |
* | Issue #20383: Introduce importlib.util.module_from_spec().Brett Cannon2014-05-301-4288/+4178
| | | | | | | | | | | | Along the way, dismantle importlib._bootstrap._SpecMethods as it was no longer relevant and constructing the new function required partially dismantling the class anyway.
* | Merge from 3.4 (for #21226).Eric Snow2014-05-131-4248/+4275
|\ \ | |/
| * Issue #21226: Set all attrs in PyImport_ExecCodeModuleObject.Eric Snow2014-05-121-4248/+4275
| |