summaryrefslogtreecommitdiffstats
path: root/Python/importlib.h
Commit message (Collapse)AuthorAgeFilesLines
* bpo-36540: PEP 570 -- Implementation (GH-12701)Pablo Galindo2019-04-291-1380/+1401
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-35321: Set the spec origin to frozen in frozen modules (#11732)Nina Zakharenko2019-02-051-656/+657
| | | | | | | | | | * bpo-35321: Set the spec origin to frozen in frozen modules This fix correctly sets the spec origin to "frozen" for the _frozen_importlib module. Note that the origin was already correctly set in _frozen_importlib_external. * 📜🤖 Added by blurb_it.
* bpo-16806: Fix `lineno` and `col_offset` for multi-line string tokens (GH-10021)Anthony Sottile2019-01-131-8/+8
|
* bpo-34100: Merge constants recursively (GH-8341)INADA Naoki2018-11-261-1506/+1479
| | | | | | | There are some same consts in a module. This commit merges them into single instance. It reduces number of objects in memory after loading modules. https://bugs.python.org/issue34100
* bpo-34876: Change the lineno of the AST for decorated function and class. ↵Serhiy Storchaka2018-10-301-1050/+1051
| | | | | | | (GH-9731) It was overridden by the lineno of the first decorator. Now it is the lineno of 'def' or 'class'.
* bpo-33331: Clean modules in the reversed order in PyImport_Cleanup(). (GH-6565)Serhiy Storchaka2018-10-291-1786/+1746
| | | | | | Modules imported last are now cleared first at interpreter shutdown. A newly imported module is moved to the end of sys.modules, behind modules on which it depends.
* bpo-25711: Rewrite zipimport in pure Python. (GH-6809)Serhiy Storchaka2018-09-181-1/+1
|
* bpo-12458: Fix line numbers for multiline expressions. (GH-8774)Serhiy Storchaka2018-09-171-1093/+1098
|
* bpo-32911: Revert bpo-29463. (GH-7121) (GH-7197)Serhiy Storchaka2018-05-291-1601/+1602
| | | | | | Remove the docstring attribute of AST types and restore docstring expression as a first stmt in their body. Co-authored-by: INADA Naoki <methane@users.noreply.github.com>
* bpo-33270: Intern names for all anonymous code objects (#6472)Zackery Spytz2018-04-151-1/+1
|
* bpo-32946: Speed up "from ... import ..." from non-packages. (GH-5873)Serhiy Storchaka2018-03-111-258/+258
|
* bpo-17611. Move unwinding of stack for "pseudo exceptions" from interpreter ↵Serhiy Storchaka2018-02-221-1648/+1653
| | | | | | | | | to compiler. (GH-5006) Co-authored-by: Mark Shannon <mark@hotpy.org> Co-authored-by: Antoine Pitrou <antoine@python.org>
* bpo-32303 - Consistency fixes for namespace loaders (#5481)Barry Warsaw2018-02-021-944/+945
| | | | | | | * 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
* bpo-24340: Fix estimation of the code stack size. (#5076)Serhiy Storchaka2018-01-091-21/+21
|
* bpo-29469: Optimize literal lists and sets iterating on the AST level. (#4866)Serhiy Storchaka2017-12-141-1743/+1742
|
* bpo-29469: Move constant folding to AST optimizer (GH-2858)INADA Naoki2017-12-141-1778/+1777
|
* bpo-21720: Restore the Python 2.7 logic in handling a fromlist. (#4118)Serhiy Storchaka2017-10-261-1773/+1783
| | | | | | BytesWarning no longer emitted when the fromlist argument of __import__() or the __all__ attribute of the module contain bytes instances.
* bpo-31642: Restore blocking "from" import by setting None in sys.modules. ↵Serhiy Storchaka2017-10-081-242/+244
| | | | (#3834)
* Trivial cleanups following bpo-31370 (#3649)Antoine Pitrou2017-09-181-96/+89
| | | | | | * Trivial cleanups following bpo-31370 * Also cleanup the "importlib._bootstrap_external" module
* bpo-31070: Fix a race condition in importlib _get_module_lock(). (#3033)Serhiy Storchaka2017-08-091-1473/+1478
|
* bpo-30891: Fix again importlib _find_and_load() (#2665)Victor Stinner2017-07-211-351/+352
| | | | | | | | | 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.
* bpo-30876: Relative import from unloaded package now reimports the package ↵Serhiy Storchaka2017-07-121-373/+365
| | | | | | | | | (#2639) instead of failing with SystemError. Relative import from non-package now fails with ImportError rather than SystemError.
* bpo-30891: Fix importlib _find_and_load() race condition (#2646)Victor Stinner2017-07-101-1535/+1526
| | | | | | * 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
* bpo-30814: Fixed a race condition when import a submodule from a package. ↵Serhiy Storchaka2017-07-061-307/+305
| | | | (#2580)
* bpo-30501: Make the compiler producing optimized code for condition ↵Serhiy Storchaka2017-06-111-409/+409
| | | | expressions. (#1851)
* Update importlib.h (GH-1762)Zachary Ware2017-05-231-2/+2
|
* bpo-22257: Small changes for PEP 432. (#1728)Eric Snow2017-05-231-1779/+1789
| | | PEP 432 specifies a number of large changes to interpreter startup code, including exposing a cleaner C-API. The major changes depend on a number of smaller changes. This patch includes all those smaller changes.
* bpo-29463: Add docstring field to some AST nodes. (#46)INADA Naoki2017-02-221-1596/+1596
| | | | | | | | | | | * bpo-29463: Add docstring field to some AST nodes. ClassDef, ModuleDef, FunctionDef, and AsyncFunctionDef has docstring field for now. It was first statement of there body. * fix document. thanks travis! * doc fixes
* Issue #26110: Add LOAD_METHOD/CALL_METHOD opcodes.Yury Selivanov2016-12-141-137/+137
| | | | | | | Special thanks to INADA Naoki for pushing the patch through the last mile, Serhiy Storchaka for reviewing the code, and to Victor Stinner for suggesting the idea (originally implemented in the PyPy project).
* 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.