| Commit message (Collapse) | Author | Age |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
As noted in gh-117983, the import importlib.util can be triggered at
interpreter startup under some circumstances, so adding threading makes
it a potentially obligatory load.
Lazy loading is not used in the stdlib, so this removes an unnecessary
load for the majority of users and slightly increases the cost of the
first lazily loaded module.
An obligatory threading load breaks gevent, which monkeypatches the
stdlib. Although unsupported, there doesn't seem to be an offsetting
benefit to breaking their use case.
For reference, here are benchmarks for the current main branch:
```
❯ hyperfine -w 8 './python -c "import importlib.util"'
Benchmark 1: ./python -c "import importlib.util"
Time (mean ± σ): 9.7 ms ± 0.7 ms [User: 7.7 ms, System: 1.8 ms]
Range (min … max): 8.4 ms … 13.1 ms 313 runs
```
And with this patch:
```
❯ hyperfine -w 8 './python -c "import importlib.util"'
Benchmark 1: ./python -c "import importlib.util"
Time (mean ± σ): 8.4 ms ± 0.7 ms [User: 6.8 ms, System: 1.4 ms]
Range (min … max): 7.2 ms … 11.7 ms 352 runs
```
Compare to:
```
❯ hyperfine -w 8 './python -c pass'
Benchmark 1: ./python -c pass
Time (mean ± σ): 7.6 ms ± 0.6 ms [User: 5.9 ms, System: 1.6 ms]
Range (min … max): 6.7 ms … 11.3 ms 390 runs
```
This roughly halves the import time of importlib.util.
|
|
|
| |
Incorporates changes from importlib_metadata 7.2.1.
|
|
|
|
|
|
|
|
|
| |
(#120640)
* Remove BEFORE_WITH and BEFORE_ASYNC_WITH instructions.
* Add LOAD_SPECIAL instruction
* Reimplement `with` and `async with` statements using LOAD_SPECIAL
|
|
|
|
|
|
|
|
|
|
|
| |
Add __all__ to the following modules:
importlib.machinery, importlib.util and xml.sax.
Add also "# noqa: F401" in collections.abc,
subprocess and xml.sax.
* Sort __all__; remove collections.abc.__all__; remove private names
* Add tests
|
| |
|
|
|
| |
Apply changes from importlib_resources 6.3.2.
|
|
|
|
| |
Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
|
|
|
|
| |
Fixes #119311. Fixes #119395.
|
|
|
|
| |
PR #119321 added a comment about the magic number bump
but did not actually apply the new magic number.
|
|
|
|
|
|
|
|
|
|
| |
The PEP 649 implementation will require a way to load NotImplementedError
from the bytecode. @markshannon suggested implementing this by converting
LOAD_ASSERTION_ERROR into a more general mechanism for loading constants.
This PR adds this new opcode. I will work on the rest of the implementation
of the PEP separately.
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
|
| |
|
|
|
|
| |
It is set by compiler with the line number of the first line of
the class definition.
|
| |
|
| |
|
|
|
|
| |
subdirectory support (GH-116609)
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Reads zip64 files as produced by the zipfile module
* Include tests (somewhat slow, however, because of the need to create "large" zips)
* About the same amount of strictness reading invalid zip files as zipfile has
* Still works on files with prepended data (like pex)
There are a lot more test cases at https://github.com/thatch/zipimport64/ that give me confidence that this works for real-world files.
Fixes #89739 and #77140.
---------
Co-authored-by: Itamar Ostricher <itamarost@gmail.com>
Reviewed-by: Gregory P. Smith <greg@krypto.org>
|
|
|
|
|
|
|
|
|
|
|
| |
* adapters
* Add comments for deferred imports with links to rationale.
* Add blurb
---------
Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
|
|
|
|
|
| |
* Apply changes from importlib_metadata 7.1.0
* Include the data sources in the makefile (even though they're not needed)
|
|
|
|
| |
Co-authored-by: Malcolm Smith <smith@chaquo.com>
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
|
|
|
|
|
|
|
|
|
| |
delegated through PathFinder. (#116812)
* Make MetadataPathFinder a proper classmethod.
* In PathFinder.invalidate_caches, also invoke MetadataPathFinder.invalidate_caches.
* Add blurb
|
|
|
|
|
|
|
|
|
|
|
| |
* Specialize CONTAINS_OP
* 📜🤖 Added by blurb_it.
* Add PyAPI_FUNC for JIT
---------
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
|
|
|
| |
Signed-off-by: cui fliter <imcusg@gmail.com>
|
|
|
| |
Setting the __class__ attribute of a lazy-loading module to ModuleType enables other threads to attempt to access attributes before the loading is complete. Now that is protected by a lock.
|
|
|
|
|
| |
* Add missed `stream` argument
* Add news
|
|
|
| |
Reduce size of _List instances
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
My criterion for delayed imports is that they're only worth it if the
majority of users of the module would benefit from it, otherwise you're
just moving latency around unpredictably.
mktime_tz is not used anywhere in the standard library and grep.app
indicates it's not got much use in the ecosystem either.
Distribution.files is not nearly as widely used as other
importlib.metadata APIs, so we defer the csv import.
Before:
```
λ hyperfine -w 8 './python -c "import importlib.metadata"'
Benchmark 1: ./python -c "import importlib.metadata"
Time (mean ± σ): 65.1 ms ± 0.5 ms [User: 55.3 ms, System: 9.8 ms]
Range (min … max): 64.4 ms … 66.4 ms 44 runs
```
After:
```
λ hyperfine -w 8 './python -c "import importlib.metadata"'
Benchmark 1: ./python -c "import importlib.metadata"
Time (mean ± σ): 62.0 ms ± 0.3 ms [User: 52.5 ms, System: 9.6 ms]
Range (min … max): 61.3 ms … 62.8 ms 46 runs
```
for about a 3ms saving with warm disk cache, maybe 7-11ms with cold disk
cache.
|
|
|
|
| |
* Compiler emits END_FOR; POP_TOP instead of END_FOR. To support tier 2 side exits in loops.
|
|
|
|
| |
guarantee_lineno_for_exits (#114267)
|
|
|
|
| |
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
|
|
|
|
| |
eval breaker (#113721)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Sync with importlib_metadata 7.0.0
* Add blurb
* Update docs to reflect changes.
* Link datamodel docs for object.__getitem__
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
* Add what's new for removed __getattr__
* Link datamodel docs for object.__getitem__
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
* Add exclamation point, as that seems to be used for other classes.
---------
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
|
|
|
| |
Add the known magic value of 3495 for Python 3.11 bytecode
|
|
|
|
| |
imported with a custom loader (#112425)
|
|
|
|
| |
frame state (#111648)
|
|
|
|
| |
(#111459)
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
This adds a 16-bit inline cache entry to the conditional branch instructions POP_JUMP_IF_{FALSE,TRUE,NONE,NOT_NONE} and their instrumented variants, which is used to keep track of the branch direction.
Each time we encounter these instructions we shift the cache entry left by one and set the bottom bit to whether we jumped.
Then when it's time to translate such a branch to Tier 2 uops, we use the bit count from the cache entry to decided whether to continue translating the "didn't jump" branch or the "jumped" branch.
The counter is initialized to a pattern of alternating ones and zeros to avoid bias.
The .pyc file magic number is updated. There's a new test, some fixes for existing tests, and a few miscellaneous cleanups.
|
| |
|
|
|
|
| |
threads (#108497)
|
|
|
|
| |
opcode.py (#107971)
|
| |
|
|
|
|
|
|
|
| |
* gh-106531: Remove importlib.resources._legacy
Syncs with importlib_resources 6.0.
* Remove documentation for removed functionality.
|
| |
|
|
|
|
|
|
| |
This enables super-instruction formation,
removal of checks for uninitialized variables,
and frees up an instruction.
|
|
|
|
| |
bytecodes.c (#105913)
|
| |
|
| |
|