summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
...
* gh-116626: Emit `CALL` events for all `INSTRUMENTED_CALL_FUNCTION_EX` ↵Tian Gao2024-03-132-28/+29
| | | | (GH-116627)
* GH-116098: Remove dead frame object creation code (GH-116687)Tian Gao2024-03-121-18/+9
|
* gh-116604: Check for `gcstate->enabled` in _Py_RunGC in free-threaded build ↵Sam Gross2024-03-121-0/+4
| | | | | | | | (#116663) This isn't strictly necessary because the implementation of `gc_should_collect` already checks `gcstate->enabled` in the free-threaded build, but it seems like a good idea until the common pieces of gc.c and gc_free_threading.c are refactored out.
* gh-116604: Correctly honor the gc status when calling _Py_RunGC (#116628)Pablo Galindo Salgado2024-03-121-0/+4
|
* gh-116515: Clear thread-local state before tstate_delete_common() (#116517)Sam Gross2024-03-111-1/+2
| | | | | | | This moves `current_fast_clear()` up so that the current thread state is `NULL` while running `tstate_delete_common()`. This doesn't fix any bugs, but it means that we are more consistent that `_PyThreadState_GET() != NULL` means that the thread is "attached".
* gh-110850: Fix _PyTime_FromSecondsDouble() API (#116606)Victor Stinner2024-03-111-7/+4
| | | | | | | | Return 0 on success. Set an exception and return -1 on error. Fix os.timerfd_settime(): properly report exceptions on _PyTime_FromSecondsDouble() failure. No longer export _PyTime_FromSecondsDouble().
* gh-116167: Allow disabling the GIL with `PYTHON_GIL=0` or `-X gil=0` (#116338)Brett Simmers2024-03-113-0/+71
| | | | | | | | | In free-threaded builds, running with `PYTHON_GIL=0` will now disable the GIL. Follow-up issues track work to re-enable the GIL when loading an incompatible extension, and to disable the GIL by default. In order to support re-enabling the GIL at runtime, all GIL-related data structures are initialized as usual, and disabling the GIL simply sets a flag that causes `take_gil()` and `drop_gil()` to return early.
* GH-116596: Better determination of escaping uops. (GH-116597)Mark Shannon2024-03-112-4/+5
|
* gh-116590: Fix unused `current_thread_holds_gil` function warning (#116591)Nikita Sobolev2024-03-111-0/+2
|
* GH-116468: Use constants instead of `oparg` in stack effects when `oparg` is ↵Mark Shannon2024-03-114-103/+93
| | | | known to be a constant. (GH-116469)
* gh-108724: Fix _PySemaphore_Wait call during thread deletion (#116483)Sam Gross2024-03-081-4/+6
| | | | | | | | | In general, when `_PyThreadState_GET()` is non-NULL then the current thread is "attached", but there is a small window during `PyThreadState_DeleteCurrent()` where that's not true: tstate_delete_common() is called when the thread is detached, but before current_fast_clear(). Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
* gh-112075: Support freeing object memory via QSBR (#116344)Dino Viehland2024-03-081-2/+8
| | | Free objects with qsbr if shared
* gh-115103: Fix unregistering of QSBR state (#116480)Sam Gross2024-03-081-3/+7
| | | | | If a thread blocks while waiting on the `shared->mutex` lock, the array of QSBR states may be reallocated. The `tstate->qsbr` values before the lock is acquired may not be the same as the value after the lock is acquired.
* gh-116447: Fix possible UB in `arraymodule` and `getargs` (#116459)Nikita Sobolev2024-03-081-2/+2
|
* GH-113710: Fix optimization of globals using `_CHECK_FUNCTION` (GH-116460)Mark Shannon2024-03-083-10/+16
|
* gh-116396: Pass "detached_state" argument to tstate_set_detached (#116398)Sam Gross2024-03-071-6/+6
| | | | The stop-the-world code was incorrectly setting suspended threads' states to _Py_THREAD_DETACHED instead of _Py_THREAD_SUSPENDED.
* gh-116381: Remove bad specializations, add fail stats (GH-116464)Ken Jin2024-03-076-194/+41
| | | * Remove bad specializations, add fail stats
* gh-116420: Fix unused var compilation warnings (GH-116466)Ken Jin2024-03-072-0/+24
| | | Fix unused var compilation warnings
* gh-116437: Use new C API PyDict_Pop() to simplify the code (GH-116438)Serhiy Storchaka2024-03-076-39/+36
|
* gh-116397: Move the _PyGC_ClearAllFreeLists to the safe point (gh-116414)Donghee Na2024-03-061-2/+5
|
* gh-116381: Specialize CONTAINS_OP (GH-116385)Ken Jin2024-03-066-8/+373
| | | | | | | | | | | * 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>
* gh-115103: Delay reuse of mimalloc pages that store PyObjects (#115435)Sam Gross2024-03-062-10/+9
| | | | | | | | | | | | | | | | | | This implements the delayed reuse of mimalloc pages that contain Python objects in the free-threaded build. Allocations of the same size class are grouped in data structures called pages. These are different from operating system pages. For thread-safety, we want to ensure that memory used to store PyObjects remains valid as long as there may be concurrent lock-free readers; we want to delay using it for other size classes, in other heaps, or returning it to the operating system. When a mimalloc page becomes empty, instead of immediately freeing it, we tag it with a QSBR goal and insert it into a per-thread state linked list of pages to be freed. When mimalloc needs a fresh page, we process the queue and free any still empty pages that are now deemed safe to be freed. Pages waiting to be freed are still available for allocations of the same size class and allocating from a page prevent it from being freed. There is additional logic to handle abandoned pages when threads exit.
* GH-113710: Tier 2 optimizer: check the function instead of checking globals. ↵Mark Shannon2024-03-064-36/+27
| | | | (GH-116410)
* GH-115687: Most comparisons create Booleans, so propagate that information ↵Mark Shannon2024-03-062-16/+68
| | | | | (GH-116360) Most comparisons create booleans
* gh-107954: Add PyConfig_MEMBER_BOOL type to PyConfigSpec (#116359)Victor Stinner2024-03-061-40/+50
| | | | | | _PyConfig_AsDict() now returns bool objects for options using the new PyConfig_MEMBER_BOOL type. Update tests for these changes.
* Fix debug output for optimized executor (#116337)Guido van Rossum2024-03-051-3/+4
| | | | This adjusts `length` rather than using `length+1` all over the place.
* GH-115685: Split `_TO_BOOL_ALWAYS_TRUE` into micro-ops (GH-116352)Mark Shannon2024-03-055-21/+27
|
* GH-115819: Eliminate Boolean guards when value is known (GH-116355)Mark Shannon2024-03-054-0/+97
|
* gh-116326: Handler errors correctly in `getwindowsversion` in `sysmodule` ↵Nikita Sobolev2024-03-051-20/+32
| | | | (#116339)
* GH-115685: Optimize `TO_BOOL` and variants based on truthiness of input. ↵Mark Shannon2024-03-054-55/+149
| | | | (GH-116311)
* gh-115320: Refactor `get_hash_info` in `sysmodule.c` not to swallow errors ↵Nikita Sobolev2024-03-041-23/+25
| | | | (#115321)
* GH-116134: JIT aarch64-pc-windows-msvc (GH-116130)Brandt Bucher2024-03-041-0/+7
|
* gh-115832: Fix instrumentation version mismatch during interpreter shutdown ↵Brett Simmers2024-03-042-1/+12
| | | | | | | | | | | | | (#115856) A previous commit introduced a bug to `interpreter_clear()`: it set `interp->ceval.instrumentation_version` to 0, without making the corresponding change to `tstate->eval_breaker` (which holds a thread-local copy of the version). After this happens, Python code can still run due to object finalizers during a GC, and the version check in bytecodes.c will see a different result than the one in instrumentation.c causing an infinite loop. The fix itself is straightforward: clear `tstate->eval_breaker` when clearing `interp->ceval.instrumentation_version`.
* gh-115103: Update refleak checker to trigger _PyMem_ProcessDelayed (gh-116238)Donghee Na2024-03-021-0/+18
|
* gh-114271: Make `_thread.ThreadHandle` thread-safe in free-threaded builds ↵mpage2024-03-011-0/+31
| | | | | | | | | | | | | | | | | (GH-115190) Make `_thread.ThreadHandle` thread-safe in free-threaded builds We protect the mutable state of `ThreadHandle` using a `_PyOnceFlag`. Concurrent operations (i.e. `join` or `detach`) on `ThreadHandle` block until it is their turn to execute or an earlier operation succeeds. Once an operation has been applied successfully all future operations complete immediately. The `join()` method is now idempotent. It may be called multiple times but the underlying OS thread will only be joined once. After `join()` succeeds, any future calls to `join()` will succeed immediately. The internal thread handle `detach()` method has been removed.
* gh-115480: Type propagate _BINARY_OP_ADD_UNICODE (GH-115710)Ken Jin2024-03-012-2/+33
|
* gh-116098: Revert "gh-107674: Improve performance of `sys.settrace` ↵Tian Gao2024-03-016-63/+53
| | | | | | | (GH-114986)" (GH-116178) Revert "gh-107674: Improve performance of `sys.settrace` (GH-114986)" This reverts commit 0a61e237009bf6b833e13ac635299ee063377699.
* gh-115999: Disable the specializing adaptive interpreter in free-threaded ↵Brett Simmers2024-03-012-0/+63
| | | | | builds (#116013) For now, disable all specialization when the GIL might be disabled.
* gh-115685: Type/values propagate for TO_BOOL in tier 2 (GH-115686)Ken Jin2024-02-294-10/+140
|
* gh-116088: Insert bottom checks after all sym_set_...() calls (#116089)Guido van Rossum2024-02-294-32/+85
| | | | | | | | | This changes the `sym_set_...()` functions to return a `bool` which is `false` when the symbol is `bottom` after the operation. All calls to such functions now check this result and go to `hit_bottom`, a special error label that prints a different message and then reports that it wasn't able to optimize the trace. No executor will be produced in this case.
* GH-115802: JIT "small" code for Windows (GH-115964)Brandt Bucher2024-02-296-30/+33
|
* gh-115816: Generate calls to sym_new_const() etc. without _Py_uop prefix ↵Guido van Rossum2024-02-291-98/+98
| | | | | | | | | (#116077) This was left behind by GH-115987. Basically a lot of diffs like this: ``` - res = _Py_uop_sym_new_unknown(ctx); + res = sym_new_unknown(ctx); ```
* gh-115859: Re-enable T2 optimizer pass by default (#116062)Guido van Rossum2024-02-285-27/+74
| | | | | | | | | | | | | This undoes the *temporary* default disabling of the T2 optimizer pass in gh-115860. - Add a new test that reproduces Brandt's example from gh-115859; it indeed crashes before gh-116028 with PYTHONUOPSOPTIMIZE=1 - Re-enable the optimizer pass in T2, stop checking PYTHONUOPSOPTIMIZE - Rename the env var to disable T2 entirely to PYTHON_UOPS_OPTIMIZE (must be explicitly set to 0 to disable) - Fix skipIf conditions on tests in test_opt.py accordingly - Export sym_is_bottom() (for debugging) - Fix various things in the `_BINARY_OP_` specializations in the abstract interpreter: - DECREF(temp) - out-of-space check after sym_new_const() - add sym_matches_type() checks, so even if we somehow reach a binary op with symbolic constants of the wrong type on the stack we won't trigger the type assert
* gh-112529: Simplify PyObject_GC_IsTracked and PyObject_GC_IsFinalized (#114732)Sam Gross2024-02-281-8/+2
|
* gh-115816: Improve internal symbols API in optimizer (#116028)Guido van Rossum2024-02-283-62/+184
| | | | | | | - Any `sym_set_...` call that attempts to set conflicting information cause the symbol to become `bottom` (contradiction). - All `sym_is...` and similar calls return false or NULL for `bottom`. - Everything's tested. - The tests still pass with `PYTHONUOPSOPTIMIZE=1`.
* gh-107674: Improve performance of `sys.settrace` (GH-114986)Tian Gao2024-02-286-53/+63
|
* gh-116012: Preserve GetLastError() across calls to TlsGetValue on Windows ↵Steve Dower2024-02-282-10/+6
| | | | (GH-116014)
* gh-105858: Improve AST node constructors (#105880)Jelle Zijlstra2024-02-281-7/+4326
| | | | | | | | | | | | | | | | | Demonstration: >>> ast.FunctionDef.__annotations__ {'name': <class 'str'>, 'args': <class 'ast.arguments'>, 'body': list[ast.stmt], 'decorator_list': list[ast.expr], 'returns': ast.expr | None, 'type_comment': str | None, 'type_params': list[ast.type_param]} >>> ast.FunctionDef() <stdin>:1: DeprecationWarning: FunctionDef.__init__ missing 1 required positional argument: 'name'. This will become an error in Python 3.15. <stdin>:1: DeprecationWarning: FunctionDef.__init__ missing 1 required positional argument: 'args'. This will become an error in Python 3.15. <ast.FunctionDef object at 0x101959460> >>> node = ast.FunctionDef(name="foo", args=ast.arguments()) >>> node.decorator_list [] >>> ast.FunctionDef(whatever="you want", name="x", args=ast.arguments()) <stdin>:1: DeprecationWarning: FunctionDef.__init__ got an unexpected keyword argument 'whatever'. Support for arbitrary keyword arguments is deprecated and will be removed in Python 3.15. <ast.FunctionDef object at 0x1019581f0>
* GH-115816: Assorted naming and formatting changes to improve ↵Mark Shannon2024-02-274-428/+453
| | | | | | | maintainability. (GH-115987) * Rename _Py_UOpsAbstractInterpContext to _Py_UOpsContext and _Py_UOpsSymType to _Py_UopsSymbol. * #define shortened form of _Py_uop_... names for improved readability.
* GH-115816: Make tier2 optimizer symbols testable, and add a few tests. ↵Mark Shannon2024-02-274-599/+612
| | | | (GH-115953)