Repository navigation
merging into my modded python. thank you for helping me - #1
Open
sidlovescoding wants to merge 387 commits into
Open
sidlovescoding wants to merge 387 commits into
sidlovescoding wants to merge 387 commits into
Conversation
…InPlaceMultiply` (#161969) Co-authored-by: Stan Ulbrych <stan@python.org>
…61933) When a class body binds __classdict__ (assignment, for target, global, del), analyze_name() treated the name as global in the annotation and type parameter scopes that can see the class, so they no longer got the __classdict__ cell the class creates for them. Compiling such a class with a generic class inside crashed, and with an annotated method or a type alias raised SystemError. Skip that rule for __classdict__ itself.
…62022) Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Under Node, NODEFS takes a new file's mtime from the host kernel but utime(path, None) uses Date.now() written back via fs.utimesSync, which can land a millisecond before the creation time. Take the baseline from utime(path, None) too, so both timestamps come from the same source. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…1147) Long ASCII runs now OR eight aligned words and test the high bits once, one branch per 64 bytes (32 on 32-bit) instead of one per word. When a block contains a non-ASCII byte, the existing one-word loop finds it. It is plain C: GCC and Clang compile it to SSE2/NEON loads, other compilers to ORed word loads with the same single branch. Multiple compiler and architecture codegen sample: https://godbolt.org/z/8bM83vx3a pyperf, PGO+LTO, 2 interleaved rounds: | Benchmark | main | this | |---|---:|---:| | (b'a' * 4096).decode() | 165 ns | 108 ns: 1.53x faster | | (b'a' * 200).decode() | 28.9 ns | 26.5 ns: 1.09x faster | | b'a' * 200 + 'é' + ..., .decode() | 60.9 ns | 56.0 ns: 1.09x faster | | b'a' * 136 + 'é' + ..., .decode() | 53.8 ns | 51.3 ns: 1.05x faster | | 8-100 byte decodes, 'é' within 100 | | within 1.2 ns | ```python import pyperf runner = pyperf.Runner() tail = 'é'.encode() + b'a' * 50 for n in (8, 100, 200, 4096): runner.timeit(f"(b'a' * {n}).decode()", "s.decode()", globals={"s": b'a' * n}) for n in (16, 100, 136, 200): runner.timeit(f"(b'a' * {n} + 'é'.encode() + b'a' * 50).decode()", "s.decode()", globals={"s": b'a' * n + tail}) ``` Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Victor Stinner <vstinner@python.org>
…essure (#152255) Co-authored-by: Victor Stinner <vstinner@python.org>
…x on Windows venvs (GH-158465) When a venv interpreter is invoked through a "\\?\" extended-length path, the venv launcher reports its own path via GetModuleFileNameW, which preserves that prefix. getpath.py consumed the value verbatim, so sys.prefix, sys.exec_prefix and sys.executable all kept the prefix. Windows does not resolve ".." or any other relative component in an extended-length path, so tools that join them onto a sysconfig path break. That is what makes "pip install" of a wheel with a "scripts=" entry fail with "OSError: [Errno 22] Invalid argument". Strip the prefix back off the launcher-provided path on Windows. A path that would still exceed MAX_PATH once unprefixed keeps the prefix, since the extended-length form is the only usable one for it.
Co-authored-by: Stan Ulbrych <stan@python.org>
Co-authored-by: Maurycy Pawłowski-Wieroński <maurycy@maurycy.com>
…162035) Modifies the iOS testbed to ensure that the path to the `utils.sh` script is quoted so that spaces in the path don't prevent the script from operating.
…H-162101) Use a shared CoroInfo constructor for tasks and futures to remove duplicate allocation and cleanup.
…H-162104) Use one helper to construct and append AwaitedInfo results for both asyncio APIs. Keep reference ownership and cleanup in the shared helper.
Use page_cache_count to identify active page cache entries. Remove the redundant validity flag, unused next pointer, and unused size macro.
Use the shared frame parser for copied stack chunks. Remove unused output parameters while preserving remote reads and fallback behavior.
Use PyBytesWriter to construct remote bytes objects. Remove the separate raw buffer allocation, copy, and cleanup.
…162748) Issue introduced in commit 1994e3f, raised in comment #162500 (comment). `delta_new_impl()` calls `accum()`, which in turn calls `PyNumber_Multiply()` and `PyNumber_Add()`, whose arguments could be a subclass of int or float that overloads `__mul__`/`__add__` with arbitrary Python code. `delta_new_impl()` calls `accum()` for 7 times in sequnce, with each of the 7 timeunit arguments, all with borrowed references, from `microseconds` to `weeks`. Chances are that those arbitrary Python code could release strong references of one of the 7 timeunit arguments. When `accum()` is called with an argument whose last references has been destroyed, it operates on a dangling pointer. Should let `delta_new_impl()` hold strong references of its arguments to avoid being released early.
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Generate complex.__new__ and its vectorcall with Argument Clinic. To keep
accepting a string only as a positional argument (complex('1') but not
complex(real='1')), real and imag are declared twice: positional-only and
keyword-only, with @text_signature keeping the visible "(real=0, imag=0)".
The previous hand-written tp_new wrapper becomes the one-argument
conversion called from complex_new_impl().
Error messages change when more than two arguments are passed in total:
a duplicated or unknown keyword is now reported as such instead of
"takes at most 2 arguments (N given)".
Microbenchmarks (pyperf, PGO+LTO):
| Benchmark | main | patch |
|-------------------------------------|:-------:|:---------------------:|
| complex(real=a_float, imag=a_float) | 67.4 ns | 37.9 ns: 1.78x faster |
| complex(a_float, imag=a_float) | 62.2 ns | 39.2 ns: 1.59x faster |
| complex(a_complex) | 18.9 ns | 12.0 ns: 1.57x faster |
| complex(a_float, a_float) | 38.0 ns | 29.2 ns: 1.30x faster |
| complex(an_int) | 36.9 ns | 29.9 ns: 1.24x faster |
| complex(a_float) | 31.0 ns | 26.0 ns: 1.19x faster |
| complex(a_str) | 48.4 ns | 41.8 ns: 1.16x faster |
| complex() | 21.1 ns | 18.5 ns: 1.14x faster |
Subclass construction (no vectorcall) is unchanged.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This fixes it's signature and adds also support for Vectorcall protocol. Co-authored-by: Cody Maloney <cmaloney@users.noreply.github.com>
Document when lazy imports resolve and how to control them at runtime. Update the AST, bytecode, and API documentation to match.
…62486) Replace hand-written `itemgetter` and `attrgetter` with Argument Clinic + vectorcall. Rename with `as itemgetter_type_new` and `as attrgetter_type_new` to avoid conflict between the generated `<name>_vectorcall` name and the existing instance-call vectorcall. There is not bad argument message change. Benchmark: ``` +-----------------+--------+----------------------+ | Benchmark | main | patch | +=================+========+======================+ | itemgetter(0) | 136 ns | 109 ns: 1.25x faster | +-----------------+--------+----------------------+ | attrgetter("x") | 162 ns | 135 ns: 1.20x faster | +-----------------+--------+----------------------+ | Geometric mean | (ref) | 1.22x faster | +-----------------+--------+----------------------+ ``` ```python import pyperf SETUP = """ import operator class C: x = 1 c = C() """ CASES = [ ('itemgetter(0)', 'operator.itemgetter(0)'), ('attrgetter("x")', 'operator.attrgetter("x")') ] runner = pyperf.Runner() for name, stmt in CASES: runner.timeit(name, stmt=stmt, setup=SETUP) ```
gh-162763) Fix a performance regression in the free-threaded build when assigning a special method to a class, such as "C.__getitem__ = f" while other threads are running. Replacing a Python function with another can now avoid stopping the world when the type slots are already up to date. Co-authored-by: Gregory P. Smith <greg@krypto.org>
…nts (GH-139273) Numbers like Decimal and Fraction are now converted exactly using as_integer_ratio() or the numerator and denominator attributes, instead of being converted to float first. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…#162863) Add "Notable changes in 3.x.y" sections.
When a test fails with "worker bug", no longer reruns failed tests in verbose mode. Previously, re-running tests in verbose mode failed to run a test called "<regrtest worker>".
Co-authored-by: Stan Ulbrych <stan@python.org>
…YTHONOPTIMIZE` set (#162847) Co-authored-by: Stan Ulbrych <stan@python.org>
…ject. (#162194) Add tooling to process site packages in an Apple Xcode project.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.