summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
* gh-119574: Add some missing environment variables to '--help-env'. (GH-120006)devdanzin2024-06-181-0/+17
|
* GH-120507: Lower the `BEFORE_WITH` and `BEFORE_ASYNC_WITH` instructions. ↵Mark Shannon2024-06-188-179/+141
| | | | | | | | | (#120640) * Remove BEFORE_WITH and BEFORE_ASYNC_WITH instructions. * Add LOAD_SPECIAL instruction * Reimplement `with` and `async with` statements using LOAD_SPECIAL
* gh-117657: Fix `__slots__` thread safety in free-threaded build (#119368)Daniele Parmeggiani2024-06-171-9/+33
| | | | Fix a race in `PyMember_GetOne` and `PyMember_SetOne` for `Py_T_OBJECT_EX`. These functions implement `__slots__` accesses for Python objects.
* gh-117657: Fix TSan reported data race on ioctl_works (#120175)Sam Gross2024-06-171-3/+5
|
* gh-115649: Copy the filename into main interpreter before intern in import.c ↵AN Long2024-06-171-1/+11
| | | | | (#120315) Co-authored-by: Kumar Aditya <kumaraditya@python.org>
* gh-119933: Improve ``SyntaxError`` message for invalid type parameters ↵Bénédikt Tran2024-06-171-26/+54
| | | | | expressions (#119976) Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* GH-120619: Clean up `RETURN_VALUE` instruction (GH-120624)Mark Shannon2024-06-177-20/+26
| | | | | * Rename _POP_FRAME to _RETURN_VALUE as it returns a value as well as popping a frame. * Remove remaining _POP_FRAMEs
* gh-120367: fix removal of redundant NOPs and jumps after reordering hot-cold ↵Irit Katriel2024-06-171-12/+18
| | | | blocks (#120425)
* gh-83754: Use the Py_TYPE() macro (#120599)Victor Stinner2024-06-172-4/+4
| | | | Don't access directly PyObject.ob_type, but use the Py_TYPE() macro instead.
* gh-120568: fix file leak in PyUnstable_CopyPerfMapFile (#120569)Carson Radtke2024-06-161-4/+4
|
* gh-120526: Correct signature of map() builtin (GH-120528)Adam Williamson2024-06-151-1/+1
| | | | | map() requires at least one iterable arg. Signed-off-by: Adam Williamson <awilliam@redhat.com>
* gh-120161: Fix a Crash in the _datetime Module (gh-120182)Eric Snow2024-06-141-0/+1
| | | | | | | In gh-120009 I used an atexit hook to finalize the _datetime module's static types at interpreter shutdown. However, atexit hooks are executed very early in finalization, which is a problem in the few cases where a subclass of one of those static types is still alive until the final GC collection. The static builtin types don't have this probably because they are finalized toward the end, after the final GC collection. To avoid the problem for _datetime, I have applied a similar approach here. Also, credit goes to @mgorny and @neonene for the new tests. FYI, I would have liked to take a slightly cleaner approach with managed static types, but wanted to get a smaller fix in first for the sake of backporting. I'll circle back to the cleaner approach with a future change on the main branch.
* gh-117657: Fix some simple races in instrumentation.c (GH-120118)Ken Jin2024-06-131-2/+2
| | | * stop the world when setting local events
* gh-120343: Fix column offsets of multiline tokens in tokenize (#120391)Lysandros Nikolaou2024-06-121-4/+10
|
* gh-120400 :Support Linux perf profile to see Python calls on RISC-V ↵ixgbe002024-06-121-0/+8
| | | | | architecture (#120089) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
* gh-120029: remove unused macros in ``symtable.c`` (#120222)Bénédikt Tran2024-06-121-1/+0
| | | | Co-authored-by: Carl Meyer <carl@oddbird.net> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* gh-93691: fix too broad source locations of for statement iterators (#120330)Irit Katriel2024-06-121-0/+7
|
* gh-120385: Fix reference leak in symtable (#120386)Kirill Podoprigora2024-06-121-1/+3
| | | Decref 'new_ste' if symtable_visit_annotations() fails.
* gh-120343: Do not reset byte_col_offset_diff after multiline tokens (#120352)Lysandros Nikolaou2024-06-111-1/+6
| | | Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
* gh-119180: PEP 649 compiler changes (#119361)Jelle Zijlstra2024-06-115-202/+368
|
* gh-119666: fix multiple class-scope comprehensions referencing __class__ ↵Carl Meyer2024-06-101-13/+10
| | | | (#120295)
* gh-119258: Eliminate Type Guards in Tier 2 Optimizer with Watcher (GH-119365)Saul Shanabrook2024-06-084-25/+107
| | | | | | | Co-authored-by: parmeggiani <parmeggiani@spaziodati.eu> Co-authored-by: dpdani <git@danieleparmeggiani.me> Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com> Co-authored-by: Ken Jin <kenjin@python.org>
* gh-120225: fix crash in compiler on empty block at end of exception handler ↵Irit Katriel2024-06-071-6/+2
| | | | (#120235)
* gh-93691: fix too broad source locations of with-statement instructions ↵Irit Katriel2024-06-071-3/+2
| | | | (#120125)
* gh-117657: Fix TSAN race involving import lock (#118523)Sam Gross2024-06-062-76/+49
| | | | | This adds a `_PyRecursiveMutex` type based on `PyMutex` and uses that for the import lock. This fixes some data races in the free-threaded build and generally simplifies the import lock code.
* gh-119786: move adaptive interpreter doc from Python to InternalsDoc (#120137)Irit Katriel2024-06-061-141/+0
|
* gh-117657: Fix race involving GC and heap initialization (#119923)Sam Gross2024-06-042-0/+6
| | | | | | | | | | | | The `_PyThreadState_Bind()` function is called before the first `PyEval_AcquireThread()` so it's not synchronized with the stop the world GC. We had a race where `gc_visit_heaps()` might visit a thread's heap while it's being initialized. Use a simple atomic int to avoid visiting heaps for threads that are not yet fully initialized (i.e., before `tstate_mimalloc_bind()` is called). The race was reproducible by running: `python Lib/test/test_importlib/partial/pool_in_threads.py`.
* Fix typos in documentation and comments (#119763)Xie Yanbo2024-06-047-9/+9
|
* gh-111499: Fix PYTHONMALLOCSTATS at Python exit (#120021)Victor Stinner2024-06-041-6/+6
| | | | Call _PyObject_DebugMallocStats() earlier in Py_FinalizeEx(), before the interpreter is deleted.
* gh-117398: Use Per-Interpreter State for the _datetime Static Types (gh-119929)Eric Snow2024-06-031-2/+2
| | | | | | | We make use of the same mechanism that we use for the static builtin types. This required a few tweaks. The relevant code could use some cleanup but I opted to avoid the significant churn in this change. I'll tackle that separately. This change is the final piece needed to make _datetime support multiple interpreters. I've updated the module slot accordingly.
* gh-117657: Fix race involving immortalizing objects (#119927)Sam Gross2024-06-033-13/+11
| | | | | | | | | The free-threaded build currently immortalizes objects that use deferred reference counting (see gh-117783). This typically happens once the first non-main thread is created, but the behavior can be suppressed for tests, in subinterpreters, or during a compile() call. This fixes a race condition involving the tracking of whether the behavior is suppressed.
* gh-117657: Avoid `sem_clockwait` in TSAN (#119915)Sam Gross2024-06-031-1/+1
| | | | The `sem_clockwait` function is not currently instrumented, which leads to false positives.
* gh-119981: Use do while(0) in some symtable.c multi-line macros (#119982)Bénédikt Tran2024-06-031-45/+52
|
* gh-117657: Fix TSAN race in QSBR assertion (#119887)Sam Gross2024-06-011-1/+2
| | | | Due to a limitation in TSAN, all reads from `PyThreadState.state` must be atomic to avoid reported races.
* gh-117657: Fix TSAN race in free-threaded GC (#119883)Sam Gross2024-06-011-3/+2
| | | | | Only call `gc_restore_tid()` from stop-the-world contexts. `worklist_pop()` can be called while other threads are running, so use a relaxed atomic to modify `ob_tid`.
* gh-74929: PEP 667 C API documentation (gh-119379)Alyssa Coghlan2024-06-014-4/+3
| | | | | | | | * Add docs for new APIs * Add soft-deprecation notices * Add What's New porting entries * Update comments referencing `PyFrame_LocalsToFast()` to mention the proxy instead * Other related cleanups found when looking for refs to the deprecated APIs
* gh-119821: Support non-dict globals in LOAD_FROM_DICT_OR_GLOBALS (#119822)Jelle Zijlstra2024-05-314-53/+54
| | | | | | | | | Support non-dict globals in LOAD_FROM_DICT_OR_GLOBALS The implementation basically copies LOAD_GLOBAL. Possibly it could be deduplicated, but that seems like it may get hairy since the two operations have different operands. This is important to fix in 3.14 for PEP 649, but it's a bug in earlier versions too, and we should backport to 3.13 and 3.12 if possible.
* gh-119369: Fix deadlock during thread exit in free-threaded build (#119528)Sam Gross2024-05-312-9/+17
| | | | | | | Release the GIL before calling `_Py_qsbr_unregister`. The deadlock could occur when the GIL was enabled at runtime. The `_Py_qsbr_unregister` call might block while holding the GIL because the thread state was not active, but the GIL was still held.
* gh-119585: Fix crash involving `PyGILState_Release()` and ↵Sam Gross2024-05-311-0/+6
| | | | | | | | | | `PyThreadState_Clear()` (#119753) Make sure that `gilstate_counter` is not zero in when calling `PyThreadState_Clear()`. A destructor called from `PyThreadState_Clear()` may call back into `PyGILState_Ensure()` and `PyGILState_Release()`. If `gilstate_counter` is zero, it will try to create a new thread state before the current active thread state is destroyed, leading to an assertion failure or crash.
* gh-119744: move a few functions from compile.c to flowgraph.c (#119745)Irit Katriel2024-05-302-151/+149
|
* gh-119689: generate stack effect metadata for pseudo instructions (#119691)Irit Katriel2024-05-292-51/+30
|
* gh-119613: Use C99+ functions instead of Py_IS_NAN/INFINITY/FINITE (#119619)Sergey B Kirpichev2024-05-295-11/+11
|
* gh-119704: Fix reference leak in the ``Python/Python-tokenize.c`` (#119705)Kirill Podoprigora2024-05-291-0/+1
|
* GH-119258: Handle STORE_ATTR_WITH_HINT in tier two (GH-119481)Brandt Bucher2024-05-284-44/+115
|
* GH-119476: Split _CHECK_FUNCTION_VERSION out of _CHECK_FUNCTION_EXACT_ARGS ↵Brandt Bucher2024-05-285-21/+21
| | | | (GH-119510)
* gh-119118: Fix performance regression in tokenize module (#119615)Lysandros Nikolaou2024-05-281-4/+40
| | | | | | | | | | * gh-119118: Fix performance regression in tokenize module - Cache line object to avoid creating a Unicode object for all of the tokens in the same line. - Speed up byte offset to column offset conversion by using the smallest buffer possible to measure the difference. Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
* gh-119676: remove several pseudo instructions which are use only in codegen ↵Irit Katriel2024-05-282-29/+5
| | | | (#119677)
* gh-117557: Improve error messages when a string, bytes or bytearray of ↵Serhiy Storchaka2024-05-281-4/+30
| | | | length 1 are expected (GH-117631)
* gh-119311: Fix name mangling with PEP 695 generic classes (#119464)Jelle Zijlstra2024-05-282-13/+48
| | | | Fixes #119311. Fixes #119395.
* gh-119584: Fix test_import Failed Assertion (gh-119623)Eric Snow2024-05-271-2/+2
| | | The fix in gh-119561 introduced an assertion that doesn't hold true if any of the three new test extension modules are loaded more than once. This is fine normally but breaks if the new test_check_state_first() is run more than once, which happens for refleak checking and with the regrtest --forever flag. We fix that here by clearing each of the three modules after loading them. We also tweak a check in _modules_by_index_check().