summaryrefslogtreecommitdiffstats
path: root/Tools
Commit message (Collapse)AuthorAgeFilesLines
* gh-85012: Properly reset msgctxt when compiling messages with msgfmt (GH-130525)Tomas R.2025-03-131-0/+1
| | | | Add also human-readable snapshots for tests.
* gh-131152: Remove unused imports from `Tools/cases_generator` (#131156)Victor Stinner2025-03-136-7/+5
|
* gh-131152: Remove unused imports from `Tools/{build,wasm}` (#131155)Victor Stinner2025-03-132-7/+0
|
* gh-111178: Change Argument Clinic signature for `@staticmethod` (#131157) ↵Victor Stinner2025-03-131-1/+4
| | | | | | (#131159) Use "PyObject*", instead of "void*", for `@staticmethod` functions to fix an undefined behavior.
* gh-127503: Improve tracebacks on Emscripten when there is a trap (#131158)Hood Chatham2025-03-131-1/+11
| | | | | | | | Modifies the behavior of the interpreter on crash under Emscripten: 1. No Python traceback shown on segfault/trap 2. The JavaScript source line is shown The JavaScript source line is super long and completely unenlightening, whereas the Python traceback is very helpful.
* gh-111178: Change Argument Clinic signature for `@classmethod` (#131157)Victor Stinner2025-03-122-6/+17
| | | | Use "PyObject*", instead of "PyTypeObject*", for `@classmethod` functions to fix an undefined behavior.
* gh-115999: Add free-threaded specialization for FOR_ITER (#128798)T. Wouters2025-03-121-0/+3
| | | | Add free-threaded versions of existing specialization for FOR_ITER (list, tuples, fast range iterators and generators), without significantly affecting their thread-safety. (Iterating over shared lists/tuples/ranges should be fine like before. Reusing iterators between threads is not fine, like before. Sharing generators between threads is a recipe for significant crashes, like before.)
* gh-111178: Change Argument Clinic signature for METH_O (#130682)Victor Stinner2025-03-113-6/+16
| | | Use "PyObject*" for METH_O functions to fix an undefined behavior.
* GH-127705: Use `_PyStackRef`s in the default build. (GH-127875)Mark Shannon2025-03-101-0/+4
|
* gh-124878: Fix race conditions during interpreter finalization (#130649)Sam Gross2025-03-062-12/+0
| | | | | | | | | | | | | | | | | | | | The PyThreadState field gains a reference count field to avoid issues with PyThreadState being a dangling pointer to freed memory. The refcount starts with a value of two: one reference is owned by the interpreter's linked list of thread states and one reference is owned by the OS thread. The reference count is decremented when the thread state is removed from the interpreter's linked list and before the OS thread calls `PyThread_hang_thread()`. The thread that decrements it to zero frees the `PyThreadState` memory. The `holds_gil` field is moved out of the `_status` bit field, to avoid a data race where on thread calls `PyThreadState_Clear()`, modifying the `_status` bit field while the OS thread reads `holds_gil` when attempting to acquire the GIL. The `PyThreadState.state` field now has `_Py_THREAD_SHUTTING_DOWN` as a possible value. This corresponds to the `_PyThreadState_MustExit()` check. This avoids race conditions in the free threading build when checking `_PyThreadState_MustExit()`.
* gh-130574: renumber RESUME opcode from 149 to 128 (GH-130685)Tomasz Pytel2025-03-062-4/+4
|
* gh-129964: Fix JIT crash on Windows on Arm (GH-130882)Diego Russo2025-03-051-1/+1
|
* GH-115802: JIT using the "medium" code model on x86_64-unknown-linux-gnu ↵Brandt Bucher2025-03-052-17/+5
| | | | (GH-130097)
* gh-118331: Fix a couple of issues when list allocation fails (#130811)mpage2025-03-051-1/+0
| | | | | | | | | | | | | | | | * Fix use after free in list objects Set the items pointer in the list object to NULL after the items array is freed during list deallocation. Otherwise, we can end up with a list object added to the free list that contains a pointer to an already-freed items array. * Mark `_PyList_FromStackRefStealOnSuccess` as escaping I think technically it's not escaping, because the only object that can be decrefed if allocation fails is an exact list, which cannot execute arbitrary code when it is destroyed. However, this seems less intrusive than trying to special cases objects in the assert in `_Py_Dealloc` that checks for non-null stackpointers and shouldn't matter for performance.
* gh-130599: use static constants str-to-int conversion (gh-130714)Neil Schemenauer2025-03-042-3/+80
| | | | | | Avoid a data race in free-threaded builds due to mutating global arrays at runtime. Instead, compute the constants with an external Python script and then define them as static global constant arrays. These constants are used by `long_from_non_binary_base()`.
* gh-130453: pygettext: Allow overriding default keywords when using ↵Tomas R.2025-03-031-1/+4
| | | | `--keyword` (GH-130709)
* GH-130296: Avoid stack transients in four instructions. (GH-130310)Mark Shannon2025-02-284-40/+34
| | | | | | | | | * Combine _GUARD_GLOBALS_VERSION_PUSH_KEYS and _LOAD_GLOBAL_MODULE_FROM_KEYS into _LOAD_GLOBAL_MODULE * Combine _GUARD_BUILTINS_VERSION_PUSH_KEYS and _LOAD_GLOBAL_BUILTINS_FROM_KEYS into _LOAD_GLOBAL_BUILTINS * Combine _CHECK_ATTR_MODULE_PUSH_KEYS and _LOAD_ATTR_MODULE_FROM_KEYS into _LOAD_ATTR_MODULE * Remove stack transient in LOAD_ATTR_WITH_HINT
* gh-124878: Add temporary TSAN suppression for free_threadstate (gh-130602)Sam Gross2025-02-282-1/+4
| | | | | The race condition with `free_threadstate` and daemon threads exists in both the free threading and default builds. We were missing a suppression in the default build.
* gh-130453: pygettext: Extend support for specifying custom keywords (GH-130463)Tomas R.2025-02-251-1/+87
|
* GH-130396: Use computed stack limits on linux (GH-130398)Mark Shannon2025-02-252-3/+3
| | | | | | | | | | | * Implement C recursion protection with limit pointers for Linux, MacOS and Windows * Remove calls to PyOS_CheckStack * Add stack protection to parser * Make tests more robust to low stacks * Improve error messages for stack overflow
* GH-91079: Revert "GH-91079: Implement C stack limits using addresses, not ↵Petr Viktorin2025-02-242-3/+3
| | | | | | | | | counters. (GH-130007)" for now (GH130413) Revert "GH-91079: Implement C stack limits using addresses, not counters. (GH-130007)" for now Unfortunatlely, the change broke some buildbots. This reverts commit 2498c22fa0a2b560491bc503fa676585c1a603d0.
* gh-111924: Fix data races when swapping allocators (gh-130287)Sam Gross2025-02-202-9/+0
| | | | | | | | | | | | | | | CPython current temporarily changes `PYMEM_DOMAIN_RAW` to the default allocator during initialization and shutdown. The motivation is to ensure that core runtime structures are allocated and freed using the same allocator. However, modifying the current allocator changes global state and is not thread-safe even with the GIL. Other threads may be allocating or freeing objects use PYMEM_DOMAIN_RAW; they are not required to hold the GIL to call PyMem_RawMalloc/PyMem_RawFree. This adds new internal-only functions like `_PyMem_DefaultRawMalloc` that aren't affected by calls to `PyMem_SetAllocator()`, so they're appropriate for Python runtime initialization and finalization. Use these calls in places where we previously swapped to the default raw allocator.
* GH-91079: Implement C stack limits using addresses, not counters. (GH-130007)Mark Shannon2025-02-192-3/+3
| | | | | | | | | | | | * Implement C recursion protection with limit pointers * Remove calls to PyOS_CheckStack * Add stack protection to parser * Make tests more robust to low stacks * Improve error messages for stack overflow
* gh-115999: Make list and tuple iteration more thread-safe. (#128637)T. Wouters2025-02-191-2/+9
| | | | | | | | | | | | | | | | | Make tuple iteration more thread-safe, and actually test concurrent iteration of tuple, range and list. (This is prep work for enabling specialization of FOR_ITER in free-threaded builds.) The basic premise is: Iterating over a shared iterable (list, tuple or range) should be safe, not involve data races, and behave like iteration normally does. Using a shared iterator should not crash or involve data races, and should only produce items regular iteration would produce. It is not guaranteed to produce all items, or produce each item only once. (This is not the case for range iteration even after this PR.) Providing stronger guarantees is possible for some of these iterators, but it's not always straight-forward and can significantly hamper the common case. Since iterators in general aren't shared between threads, and it's simply impossible to concurrently use many iterators (like generators), better to make sharing iterators without explicit synchronization clearly wrong. Specific issues fixed in order to make the tests pass: - List iteration could occasionally fail an assertion when a shared list was shrunk and an item past the new end was retrieved concurrently. There's still some unsafety when deleting/inserting multiple items through for example slice assignment, which uses memmove/memcpy. - Tuple iteration could occasionally crash when the iterator's reference to the tuple was cleared on exhaustion. Like with list iteration, in free-threaded builds we can't safely and efficiently clear the iterator's reference to the iterable (doing it safely would mean extra, slow refcount operations), so just keep the iterable reference around.
* gh-129989: Change Py_TAIL_CALL_INTERP ifndef to ! (#130269)Ken Jin2025-02-181-2/+2
| | | Change Py_TAIL_CALL_INTERP ifndef to !
* gh-44827: Improve error if BOM on first line of .po file (GH-130187)Stan Ulbrych2025-02-181-0/+10
|
* gh-130195: Remove unimplemented option from pygettext (#130196)Stan Ulbrych2025-02-181-1/+3
| | | Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
* gh-130057: Pygettext: Support translator comments (GH-130061)Tomas R.2025-02-171-14/+91
|
* gh-129805: Fix `bytes` annotation in `Tools/jit` (#129806)sobolevn2025-02-172-5/+18
|
* gh-129989: Properly disable tailcall interp in configure (GH-129991)Ken Jin2025-02-152-2/+2
| | | Co-authored-by: Zanie Blue <contact@zanie.dev>
* gh-129911: pygettext: Fix the keyword entry in help output (GH-129914)Tomas R.2025-02-141-2/+3
|
* GH-115869: Don't JIT zeroed bytes (GH-130023)Brandt Bucher2025-02-131-4/+5
|
* gh-128130: Fix unhandled keyboard interrupt data race (gh-129975)Sam Gross2025-02-131-1/+1
| | | | | | | | | | Use an atomic operation when setting `_PyRuntime.signals.unhandled_keyboard_interrupt`. We now only clear the variable at the start of `_PyRun_Main`, which is the same function where we check it. This avoids race conditions where previously another thread might call `run_eval_code_obj()` and erroneously clear the unhandled keyboard interrupt.
* GH-107956: install build-details.json (PEP 739) (#130069)Filipe Laíns 🇵🇸2025-02-131-0/+192
|
* GH-128682: Account for escapes in `DECREF_INPUTS` (GH-129953)Mark Shannon2025-02-125-46/+149
| | | | | | | | * Handle escapes in DECREF_INPUTS * Mark a few more functions as escaping * Replace DECREF_INPUTS with PyStackRef_CLOSE where possible
* gh-128446: Skip Windows CI for Unix build system changes (#128450)Srinivas Reddy Thatiparthy (తాటిపర్తి శ్రీనివాస్ రెడ్డి)2025-02-121-0/+25
| | | | | Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com> Authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
* gh-117657: Enable test_opcache under TSAN (GH-129831)Sam Gross2025-02-111-0/+3
| | | | | | | | Fix a few thread-safety bugs to enable test_opcache when run with TSAN: * Use relaxed atomics when clearing `ht->_spec_cache.getitem` (gh-115999) * Add temporary suppression for type slot modifications (gh-127266) * Use atomic load when reading `*dictptr`
* gh-104400: pygettext: use an AST parser instead of a tokenizer (GH-104402)Tomas R.2025-02-111-228/+91
| | | This greatly simplifies the code and fixes many corner cases.
* gh-100239: replace BINARY_SUBSCR & family by BINARY_OP with oparg NB_SUBSCR ↵Irit Katriel2025-02-071-3/+1
| | | | (#129700)
* GH-129715: Remove _DYNAMIC_EXIT (GH-129716)Brandt Bucher2025-02-071-0/+5
|
* GH-129709: Clean up tier two (GH-129710)Brandt Bucher2025-02-074-57/+25
|
* GH-129763: Remove the LLTRACE macro (GH-129764)Brandt Bucher2025-02-073-2/+5
|
* gh-128563: Move assignment of opcode into ifdef (GH-129803)Ken Jin2025-02-071-3/+4
|
* Emscripten: use better `_Py_Version` computation for worker module (#129757)Agriya Khetarpal2025-02-071-6/+3
| | | Use integer bit shifting instead of conversion to strings to compute Python version.
* gh-117657: Include all of test_free_threading in TSAN tests (#129749)Sam Gross2025-02-061-0/+6
|
* gh-117657: Fix data race in `new_reference` for free threaded build (gh-129665)Bogdan Romanyuk2025-02-061-1/+0
|
* gh-129707: Check `Tools/build/compute-changes.py` with `mypy` (#129708)sobolevn2025-02-061-1/+3
| | | | Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
* gh-128563: A new tail-calling interpreter (GH-128718)Ken Jin2025-02-065-48/+109
| | | | | Co-authored-by: Garrett Gu <garrettgu777@gmail.com> Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
* Convert change detection to a Python script (#129627)Adam Turner2025-02-051-0/+183
| | | | Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Co-authored-by: Sviatoslav Sydorenko (Святослав Сидоренко) <wk.cvs.github@sydorenko.org.ua>
* gh-104400: pygettext: Prepare to replace TokenEater with a NodeVisitor (#129672)Tomas R.2025-02-041-68/+69
| | | | | * Update the module docstring * Move ``key_for`` inside the class * Move ``write_pot_file`` outside the class