Repository navigation
merging into my modded python. thank you for helping me - #1
Open
sidlovescoding wants to merge 455 commits into
Open
sidlovescoding wants to merge 455 commits into
sidlovescoding wants to merge 455 commits into
Conversation
…tors (#162241) Remove the integer-location branches from the sampling collectors. Live samples and binary replay use four-field locations or None.
Doc: Correct examples and API descriptions in the logging HOWTO and cookbook
Rename HAVE_CURSES_xxx macros, added to Python 3.16, to _Py_HAVE_CURSES_xxx. Rename macros of functions: * define_key(): HAVE_CURSES_DEFINE_KEY * has_mouse(): HAVE_CURSES_HAS_MOUSE * is_keypad(): HAVE_CURSES_IS_KEYPAD * is_leaveok(): HAVE_CURSES_IS_LEAVEOK * key_defined(): HAVE_CURSES_KEY_DEFINED * keyok(): HAVE_CURSES_KEYOK * new_prescr(): HAVE_CURSES_NEW_PRESCR * nofilter(): HAVE_CURSES_NOFILTER * scr_dump(): HAVE_CURSES_SCR_DUMP * scr_set(): HAVE_CURSES_SCR_SET * slk_attr_off(): HAVE_CURSES_SLK_ATTR_OFF * slk_attr_on(): HAVE_CURSES_SLK_ATTR_ON * slk_attr_set(): HAVE_CURSES_SLK_ATTR_SET * slk_color(): HAVE_CURSES_SLK_COLOR * term_attrs(): HAVE_CURSES_TERM_ATTRS * use_screen(): HAVE_CURSES_USE_SCREEN * use_window(): HAVE_CURSES_USE_WINDOW * wattr_get(): HAVE_CURSES_WATTR_GET * wattr_off(): HAVE_CURSES_WATTR_OFF * wattr_on(): HAVE_CURSES_WATTR_ON * wattr_set(): HAVE_CURSES_WATTR_SET * wcolor_set(): HAVE_CURSES_WCOLOR_SET Add PY_CHECK_CURSES_FUNC_PRIVATE() function to configure.ac.
When running "python -m test" with --tsan or --tsan-parallel, display the test header (log TSAN_OPTIONS env var).
* Push NULL and None in GET_AWAITABLE Every await site compiled to GET_AWAITABLE; PUSH_NULL; LOAD_CONST None; SEND. GET_AWAITABLE is always followed by that pair, so let it push (iter, NULL, None) itself. `await f()` now compiles to CALL; GET_AWAITABLE; SEND, saving two dispatches per await. The tier-2 optimizer gets an override so the NULL and None slots are known constants. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Add NEWS entry Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Stan Ulbrych <stan@python.org>
Every async for iteration compiled to GET_ANEXT; PUSH_NULL; LOAD_CONST None; SEND. GET_ANEXT is always followed by that pair, so let it push (aiter, awaitable, NULL, None) itself, saving two dispatches per iteration. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Avoid a temporary PyMem_Malloc() buffer: create directly a bytes object using PyBytesWriter API.
When a test fails with "worker bug" and tests are rerun in verbose mode, reset worker_bug so that tests are marked as success if the failed test doesn't fail again when rerun in verbose mode. TestResult.write_json_into(file) now calls also file.flush().
….json (#161532) With --with-build-python, the build Python can differ from the target in patch version or release serial, but version_info and hexversion came from the running interpreter. Read them from Include/patchlevel.h instead, falling back to sys.version_info when the header is not there. Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…e queued for BRC merging (#162316)
…60312) Co-authored-by: Kumar Aditya <kumaraditya@python.org>
…r a cancelled wait_closed() (#162317)
) Py_INCREF(), Py_XINCREF(), Py_DECREF() and Py_XDECREF() are now implemented as function calls on all limited C API versions. Previously, they were only implemented as function calls on the limited C API version 3.12 or newer. Previously, if a C extension was built with the limited C API version 3.11 or newer, Py_DECREF() was implemented as "op->ob_refcnt--". But Python 3.12 made Py_DECREF() more complicated to implement immortal objects in an efficient way. "op->ob_refcnt--" can convert an immortal object to a mortal object which causes various kinds of nasty bugs. Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com> Co-authored-by: Petr Viktorin <encukou@gmail.com>
…ative() (#162268) Wait for child execve() before creating `RemoteUnwinder`. Use _target_processing() to sync with the child process. Co-authored-by: Victor Stinner <vstinner@python.org>
…0619) Co-authored-by: Kumar Aditya <kumaraditya@python.org>
…yMem_FreeDelayed()` (#160698)
…res (#161508) Include intermediate Future nodes when the remote asyncio unwinder builds awaited-by graphs.
`socket.makefile("rwb")` passes the same raw stream to both sides of a `BufferedRWPair`. When the pair is deallocated, the reader closes the stream before the writer can flush its buffer.
Release the writer first, matching the order in `BufferedRWPair.close()`.
…#162352) Temporary workaround to get bots green until importlib.metadata cleans these up itself. FastPath keeps the fixture ZipFiles alive because of a cycle in its cache. That means they get closed on deallocation resulting in the unclosed file warning. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
) configure sets _PYTHON_HOST_PLATFORM only for cross builds, but passed it to the build Python for every --with-build-python build. In a native build it was empty, so sysconfig.get_platform() returned "" and build-details.json ended up with "platform": "". Co-authored-by: Zanie Blue <contact@zanie.dev> Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> Co-authored-by: Kushal Das <mail@kushaldas.in>
…lement (#162653) xml.etree.ElementTree.Element replaces PyArg_ParseTuple with Argument Clinic and gains a generated vectorcall. Keys that are not strings in `**extra` now raise TypeError on a normal call, as the Python implementation already did, because vectorcall keywords must be strings; an explicit `__init__` call and subclasses still accept them. Arity errors use the generated wording ("Element expected at most 2 arguments, got 3"). `@text_signature` keeps the documented `(tag, /, attrib={}, **extra)`; the `/` is new in the signature, `tag` was already positional-only. `attrib` can still be passed by keyword, which the impl pops from `extra`. Merging the keywords into the attributes now copies them with PyDict_Copy() instead of PyDict_New() plus PyDict_Update(), and pops `attrib` with `_Py_ID(attrib)` rather than creating a string per call; SubElement shares that helper. pyperf microbenchmark (PGO+LTO, run serially): | Benchmark | base | Element | |------------------------|:-------:|:---------------------:| | E('a', x='1') | 121 ns | 78.7 ns: 1.53x faster | | E('a', attrib=d) | 123 ns | 86.1 ns: 1.43x faster | | E('a') | 41.9 ns | 29.4 ns: 1.43x faster | | E('a', d) | 75.8 ns | 55.6 ns: 1.36x faster | | SE(E('p'), 'a', x='1') | 161 ns | 120 ns: 1.34x faster | | build() | 22.2 us | 17.2 us: 1.29x faster | | S('a') | 49.6 ns | 40.8 ns: 1.22x faster | | E('a', d, y='2') | 103 ns | 85.4 ns: 1.21x faster | Not significant: fromstring(doc) (C parser, unchanged path). Benchmark code: ```python import pyperf runner = pyperf.Runner() setup = """ from xml.etree.ElementTree import Element as E, SubElement as SE, fromstring d = {'x': '1'} class S(E): pass def build(): root = E('root') for i in range(100): c = SE(root, 'item', id='1') c.append(E('v', d)) return root doc = '<root>' + '<item id="1"><v x="1"/></item>' * 100 + '</root>' """ for stmt in ["E('a')", "E('a', d)", "E('a', x='1')", "E('a', d, y='2')", "E('a', attrib=d)", "S('a')", "SE(E('p'), 'a', x='1')", "build()", "fromstring(doc)"]: runner.timeit(stmt, stmt, setup) ``` Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
_PySet_NextEntryRef() already has the same ASSERT_SET_LOCKED(). Add also some assertions to other setobject.c functions to make sure that a set is locked when calling set_next() on it.
Update mac.rst: change tcl/tk homepage to actual current one The tcl.tk domain no longer has anything to do with Tcl or Tk! Current homepage is at https://www.tcl-lang.org/
If Py_FatalError() is called in an early state of Py_Finalize(), report the state "finalizing" from the interpreter state.
Move PyTime C API tests from test_time to test_capi.test_time. Compute TIME_T_MIN and TIME_T_MAX at the module level.
* commit 31765b252c42922e5dd5dd1fa8038147eec0de87: Backport applicable macro and configuration fixes (#1506) * commit 256e4f7b8ef6a6b628e49df430746e69a34dd956: Fix slice-size typo and CMake configuration checks (#1506) * commit cd9251e9280905dc485a713d1e0fc7293a4460e0: Make public headers -Wundef-safe and suppress it in static.c, see also #1506 * commit 0fe41040c07b2adc346801f2a520a3299f63615e: make internal headers -Wundef clean and include limits.h in types.h (see #1506)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
#162475) Co-authored-by: Stan Ulbrych <stan@python.org>
Replace hand-written `defdict_init` with AC + vectorcall. There is no bad arguments message change.
For argument `default_factory`: `dd->default_factory = Py_NewRef(default_factory)` creates strong reference before `result = PyDict_Type.tp_init(self, newargs, kwargs)` runs arbitrary code. For `args` and `kwargs`: `defdict_vectorcall()` already creates strong references for both before calling `defdict_init_impl()`.
The `default_factory` argument defaults to `None`, so `defaultdict()` is functionally equivalent to `defaultdict(None)`, thus AC declaration uses `default_factory: object = None`. It should not add `(c_default="NULL")` as that causes error at the `default_factory != Py_None` check, thus didn't use `default_factory: object(c_default="NULL") = None`.
Benchmark:
```
+-------------------------+--------+----------------------+
| Benchmark | main | patch |
+=========================+========+======================+
| defaultdict() | 146 ns | 110 ns: 1.33x faster |
+-------------------------+--------+----------------------+
| defaultdict(list) | 169 ns | 118 ns: 1.43x faster |
+-------------------------+--------+----------------------+
| defaultdict(list, kw) | 239 ns | 168 ns: 1.42x faster |
+-------------------------+--------+----------------------+
| defaultdict(list, **kw) | 286 ns | 358 ns: 1.25x slower |
+-------------------------+--------+----------------------+
| Geometric mean | (ref) | 1.21x faster |
+-------------------------+--------+----------------------+
```
```python
import pyperf
SETUP = """
from collections import defaultdict
kw = {'a': 1, 'b': 2}
"""
CASES = [
('defaultdict()', 'defaultdict()'),
('defaultdict(list)', 'defaultdict(list)'),
('defaultdict(list, kw)', 'defaultdict(list, kw)'),
('defaultdict(list, **kw)', 'defaultdict(list, **kw)')
]
runner = pyperf.Runner()
for name, stmt in CASES:
runner.timeit(name, stmt=stmt, setup=SETUP)
```
…#163024) If a build has already generated `idle3` and `pydoc3`, reconfiguring it with `--enable-relocatable` can leave both scripts with absolute shebangs. `make install` copies the stale scripts, which then fail when the installation moves. Make both targets depend on the generated `Makefile` so a change to the installation prefix or `--enable-relocatable` regenerates their headers.
The importlib tests of _write_atomic() used _pyio so they could patch os.write(). Replace _io.open() with a BufferedWriter over a FileIO whose writes are cut short instead. Also check the written contents and that no temporary file is left behind after a failure. The zipfile test only needs a BytesIO subclass that counts reads, which io.BytesIO supports. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Replace the hand-written `dialect_new` with an Argument Clinic + vectorcall. Move `_csv_Dialect___replace___impl()` from calling `dialect_new()` to `dialect_new_helper()` to avoid temporary tuple.
Error message for too many arguments is now `TypeError: Dialect() takes at most 9 arguments (N given)` instead of `TypeError: function takes at most 9 arguments (N given)`.
Benchmark:
```
+-------------------------------------------------+---------+-----------------------+
| Benchmark | main | patch |
+=================================================+=========+=======================+
| _csv.Dialect() | 240 ns | 198 ns: 1.22x faster |
+-------------------------------------------------+---------+-----------------------+
| _csv.Dialect().__replace__(**{'delimiter':','}) | 1.79 us | 1.55 us: 1.15x faster |
+-------------------------------------------------+---------+-----------------------+
| csv.reader(f) | 409 ns | 381 ns: 1.07x faster |
+-------------------------------------------------+---------+-----------------------+
| csv.reader(f, delimiter=';') | 803 ns | 557 ns: 1.44x faster |
+-------------------------------------------------+---------+-----------------------+
| csv.writer(g) | 399 ns | 371 ns: 1.08x faster |
+-------------------------------------------------+---------+-----------------------+
| parse_small() | 5.45 us | 5.07 us: 1.07x faster |
+-------------------------------------------------+---------+-----------------------+
| Geometric mean | (ref) | 1.14x faster |
+-------------------------------------------------+---------+-----------------------+
Benchmark hidden because not significant (1): parse_large()
```
```python
import pyperf
SETUP = """
import _csv, csv, io
f = io.StringIO()
g = io.StringIO()
small_data = "a,b,c\\n" + "1,2,3\\n" * 20 # ~140 bytes
large_data = "a,b,c\\n" + "1,2,3\\n" * 50000 # ~350 KB
def parse_small():
for row in csv.reader(io.StringIO(small_data), delimiter=','):
pass
def parse_large():
for row in csv.reader(io.StringIO(large_data), delimiter=','):
pass
"""
CASES = [
("_csv.Dialect()", "_csv.Dialect()"),
("_csv.Dialect().__replace__(**{'delimiter':','})", "_csv.Dialect().__replace__(**{'delimiter':','})"),
("csv.reader(f)", "csv.reader(f)"),
("csv.reader(f, delimiter=';')", "csv.reader(f, delimiter=';')"),
("csv.writer(g)", "csv.writer(g)"),
("parse_small()", "parse_small()"),
("parse_large()", "parse_large()"),
]
runner = pyperf.Runner()
for name, stmt in CASES:
runner.timeit(name, stmt=stmt, setup=SETUP)
```
Co-authored-by: Victor Stinner <vstinner@python.org>
bug announcer: Replace unpinned npm install with Python stdlib
…H-162725) Call Tcl_FinalizeThread() when the Python thread state is cleared at the end of a thread which made calls to a Tcl interpreter in other thread or created a Tcl interpreter, unless the thread still has a Tcl interpreter. This fixes a leak of an event handle on Windows for every such thread. The explicit _tkinter._finalize_thread() calls in tests are no longer needed.
…t in `x_mul()` (#157743) * Speed up int multiplication by not zeroing the whole result first
…s are avail… (#162474) Fix test.test_capi.test_watchers assuming which watcher IDs are available Some watcher tests hardcode watcher IDs 1 and 3 and assume them to be available. Instead, force an available watcher ID by creating and then immediately removing a watcher. This makes the tests a bit more resilient in the face of other modules registering watchers.
… event (#159238) Co-authored-by: Victor Stinner <vstinner@python.org>
Run the io tests against the C implementation only. The _pyio test classes and mocks go away, and tests that the C classes shared with them move into mixins. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.