summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
...
* gh-58124: Avoid CP_UTF8 in UnicodeDecodeError (#137415)Victor Stinner2025-08-061-1/+1
| | | | | Fix name of the Python encoding in Unicode errors of the code page codec: use "cp65000" and "cp65001" instead of "CP_UTF7" and "CP_UTF8" which are not valid Python code names.
* Use PyConfig_Get() in frozenmain.c (#137421)Victor Stinner2025-08-061-9/+8
| | | | | Replace private _Py_GetConfig() with public PyConfig_Get(). Remove also explicit PyRuntime initialization, it's not needed.
* gh-137288: Fix bug where boolean expressions are not associated with the ↵Irit Katriel2025-08-051-0/+7
| | | | correct exception handler (#137310)
* gh-137238: Fix data race in `_Py_slot_tp_getattr_hook` (gh-137240)Sam Gross2025-08-051-8/+1
| | | | | Replacing the slot isn't thread-safe if the GIL is disabled. Don't require that the slot has been replaced when specializing.
* gh-134170: Add colorization to unraisable exceptions (#134183)Peter Bierma2025-08-041-1/+26
| | | | | | Default implementation of sys.unraisablehook() now uses traceback._print_exception_bltin() to print exceptions with colorized text. Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> Co-authored-by: Victor Stinner <vstinner@python.org>
* gh-137308: Replace a single docstring with `pass` in `-OO` mode (#137318)sobolevn2025-08-021-1/+26
| | | | This is required so we would never have empty node bodies. Refs #130087
* GH-136410: Faster side exits by using a cold exit stub (GH-136411)Mark Shannon2025-08-019-75/+174
|
* GH-134291: Support older macOS deployment targets for JIT builds (GH-137211)Brandt Bucher2025-07-301-14/+1
|
* gh-137185: Fix `_Py_DumpStack()` async signal safety (gh-137187)Sam Gross2025-07-291-0/+10
| | | | | | | | Call backtrace() once when installing the signal handler to ensure that libgcc is dynamically loaded outside the signal handler. This fixes a "signal-unsafe call inside of a signal" TSan error from test_faulthandler.test_enable_fd.
* gh-131338: Disable computed stack limit checks on non-glibc linux (#134336)R. David Murray2025-07-281-1/+5
| | | | Co-authored-by: Kumar Aditya <kumaraditya@python.org> Co-authored-by: Victor Stinner <vstinner@python.org>
* GH-132732: Use pure op machinery to optimize `COMPARE_OP_INT/FLOAT/STR` ↵Savannah Bailey2025-07-263-36/+184
| | | | | (#137062) Co-authored-by: Ken Jin <kenjin4096@gmail.com>
* gh-137084: remove multiple calls to `get_gc_state` in `gc.c` (#137085)Sergey Miryanov2025-07-251-1/+1
|
* gh-136870: fix data races in instrumentation of bytecode (#136994)Kumar Aditya2025-07-241-8/+12
| | | De-instrumenting code objects modifies the thread local bytecode for all threads as such, holding the critical section on the code object is not sufficient and leads to data races. Now, the de-instrumentation is now performed under a stop the world pause as such no thread races with executing the thread local bytecode while it is being de-instrumented.
* gh-137054: remove obsolete counting of objects in young generation under ↵Sergey Miryanov2025-07-241-9/+0
| | | | `Py_STATS` builds (#137055)
* gh-136459: Use platform-specific type in perf_jit_trampoline (GH-137031)Petr Viktorin2025-07-231-0/+4
| | | | | gh-136461 added perf support for macOS, with ifdefs around all changes except increasing thread_id to 64 bits. Make that change Apple-specific too.
* gh-136459: Add perf trampoline support for macOS (#136461)Nazım Can Altınova2025-07-222-3/+45
|
* Revert "gh-112068: C API: Add support of nullable arguments in PyArg_Parse ↵Serhiy Storchaka2025-07-221-160/+87
| | | | (GH-121303)" (#136991)
* gh-124621: Emscripten: Fix __syscall_ioctl patch (GH-136993)Hood Chatham2025-07-221-2/+6
| | | | | If there is an error, we have to return `-errno` not positive errno. Included in backport of GH-136931: #136988
* gh-124621: Emscripten: Support pyrepl in browser (GH-136931)Hood Chatham2025-07-221-9/+107
| | | | | | | | | | | | | | | | Basic support for pyrepl in Emscripten. Limitations: * requires JSPI * no signal handling implemented As followup work, it would be nice to implement a webworker variant for when JSPI is not available and proper signal handling. Because it requires JSPI, it doesn't work in Safari. Firefox requires setting an experimental flag. All the Chromiums have full support since May. Until we make it work without JSPI, let's keep the original web_example around. Co-authored-by: Łukasz Langa <lukasz@langa.pl> Co-authored-by: Éric <merwok@netwok.org>
* gh-133296: Publicly expose critical section API that accepts PyMutex (gh-135899)Nathan Goldbaum2025-07-211-0/+18
| | | | | | | | | | | | | | | This makes the following APIs public: * `Py_BEGIN_CRITICAL_SECTION_MUTEX(mutex),` * `Py_BEGIN_CRITICAL_SECTION2_MUTEX(mutex1, mutex2)` * `void PyCriticalSection_BeginMutex(PyCriticalSection *c, PyMutex *mutex)` * `void PyCriticalSection2_BeginMutex(PyCriticalSection2 *c, PyMutex *mutex1, PyMutex *mutex2)` The macros are identical to the corresponding `Py_BEGIN_CRITICAL_SECTION` and `Py_BEGIN_CRITICAL_SECTION2` macros (e.g., they include braces), but they accept a `PyMutex` instead of an object. The new macros are still paired with the existing END macros (`Py_END_CRITICAL_SECTION`, `Py_END_CRITICAL_SECTION2`).
* gh-136870: fix data race in `PyThreadState_Clear` on `sys_tracing_threads` ↵Kumar Aditya2025-07-211-0/+9
| | | | | (#136951) In free-threading, multiple threads can be cleared concurrently as such the modifications on `sys_tracing_threads` should be done while holding the profile lock, otherwise it can race with other threads setting up profiling.
* gh-136421: Load `_datetime` static types during interpreter initialization ↵Peter Bierma2025-07-211-0/+5
| | | | | (GH-136583) `_datetime` is a special module, because it's the only non-builtin C extension that contains static types. As such, it would initialize static types in the module's execution function, which can run concurrently. Since static type initialization is not thread-safe, this caused crashes. This fixes it by moving the initialization of `_datetime`'s static types to interpreter startup (where all other static types are initialized), which is already properly protected through other locks.
* gh-136251: Improvements to WASM demo REPL (GH-136252)adam j hartz2025-07-211-1/+1
| | | Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
* gh-134411: assert `PyLong_FromLong(x) != NULL` when `x` is known to be small ↵Sergey Muraviov2025-07-211-0/+4
| | | | | | (#134415) Since `PyLong_From Long(PY_MONITORING_DEBUGGER_ID)` falls to `small_int` case and can't return `NULL`. Added `assert`s for extra confidence. https://github.com/python/cpython/issues/134411#issuecomment-2897653868
* gh-132661: Disallow `Template`/`str` concatenation after PEP 750 spec update ↵Dave Peck2025-07-212-92/+4
| | | | | | | (#135996) Co-authored-by: sobolevn <mail@sobolevn.me> Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
* gh-124621: Emscripten: Fix regression in use-after-close error handling ↵Hood Chatham2025-07-191-1/+8
| | | | (#136837)
* gh-124621: Emscripten: Add support for async input devices (GH-136822)Hood Chatham2025-07-191-0/+175
| | | | | | | | | | | | | | | | | | This is useful for implementing proper `input()`. It requires the JavaScript engine to support the wasm JSPI spec which is now stage 4. It is supported on Chrome since version 137 and on Firefox and node behind a flag. We override the `__wasi_fd_read()` syscall with our own variant that checks for a readAsync operation. If it has it, we use our own async variant of `fd_read()`, otherwise we use the original `fd_read()`. We also add a variant of `FS.createDevice()` called `FS.createAsyncInputDevice()`. Finally, if JSPI is available, we wrap the `main()` symbol with `WebAssembly.promising()` so that we can stack switch from `fd_read()`. If JSPI is not available, attempting to read from an AsyncInputDevice will raise an `OSError`.
* gh-127146: Emscripten: Make os.umask() actually work (#136706)Hood Chatham2025-07-161-1/+21
| | | | Provide a stub implementation of umask that is enough to get some tests passing. More work is needed upstream in Emscripten to make all umask tests to pass.
* gh-127146: Report uid in Emscripten + node as native uid (#136509)Hood Chatham2025-07-161-0/+19
| | | | Corrects the handling of getuid on emscripten, which was consistently reporting as 0.
* gh-135909: Assert incoming `refcnt != 0` for the free threaded GC (GH-136009)andrewreds2025-07-151-7/+15
| | | | | | This helps catch double deallocation bugs and is similar to the assertion in the GIL-enabled build. The call to `validate_refcounts` is moved up to start of the GC because `queue_untracked_obj_decref()` creates it own zero reference count garbage.
* GH-133711: Enable UTF-8 mode by default (PEP 686) (#133712)Adam Turner2025-07-152-25/+9
| | | Co-authored-by: Victor Stinner <vstinner@python.org>
* Fix a minor indentation error (#136661)Tian Gao2025-07-151-1/+1
|
* GH-135904: Improve the JIT's performance on macOS (GH-136528)Brandt Bucher2025-07-141-4/+7
|
* gh-121914: Change the names of the symbol tables for lambda and genexpr ↵Serhiy Storchaka2025-07-131-5/+5
| | | | | | | (GH-135288) Change the names of the symbol tables for lambda expressions and generator expressions to "<lambda>" and "<genexpr>" respectively to avoid conflicts with user-defined names.
* gh-132629: Deprecate accepting out-of-range values for unsigned integers in ↵Serhiy Storchaka2025-07-131-20/+63
| | | | | | | | | | PyArg_Parse (GH-132630) For unsigned integer formats in the PyArg_Parse* functions, accepting Python integers with value that is larger than the maximal value the corresponding C type or less than the minimal value for the corresponding signed integer type is now deprecated.
* Doc: More duplicate word fixes (GH-136299)Weilin Du2025-07-111-1/+1
|
* gh-136541: Fix several problems of perf trampolines in x86_64 and aarch64 ↵Pablo Galindo Salgado2025-07-113-41/+144
| | | | | | | | | | (#136500) This commit fixes the following problems: * The x86_64 trampolines are not preserving frame pointers * The hardcoded offsets to the code segment from the FDE only worked properly for x64_64 * The CIE data was not following conventions of aarch64 * The eh_frame for aarch64 was not fully correct
* gh-136517: Print uncollectable objects if DEBUG_UNCOLLECTABLE mode was set ↵Sergey Miryanov2025-07-101-1/+1
| | | | (#136518)
* gh-135953: Implement sampling tool under profile.sample (#135998)László Kiss Kollár2025-07-101-1/+21
| | | | | | | | Implement a statistical sampling profiler that can profile external Python processes by PID. Uses the _remote_debugging module and converts the results to pstats-compatible format for analysis. Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
* gh-91048: Revert the memory cache removal for remote debugging (#136440)Pablo Galindo Salgado2025-07-091-0/+78
| | | gh-91048: Reintroduce the memory cache for remote debugging
* GH-91636: Clear weakrefs created by finalizers. (GH-136401)Neil Schemenauer2025-07-082-7/+38
| | | | | Weakrefs to unreachable garbage that are created during running of finalizers need to be cleared. This avoids exposing objects that have `tp_clear` called on them to Python-level code.
* gh-134043: use `_PyObject_GetMethodStackRef` in pattern matching (#136356)Kumar Aditya2025-07-081-4/+6
|
* gh-102567: Add missing newline to `--help-all` (GH-136391)Hugo van Kemenade2025-07-081-1/+1
|
* gh-109700: fix interpreter finalization while handling memory error (#136342)Kumar Aditya2025-07-071-7/+7
|
* gh-115999: remove redundant check in free-threading from ↵Kumar Aditya2025-07-043-25/+0
| | | | `_STORE_ATTR_WITH_HINT` (#136249)
* `Python/gc.c`: Refer to `InternalDocs` instead of devguide. (#136243)Kirill Podoprigora2025-07-031-1/+1
|
* gh-136183: Deal with escapes in JIT optimizer's constant evaluator (GH-136184)Ken Jin2025-07-021-3/+3
|
* gh-134009: Expose `PyMutex_IsLocked` in the public C API (gh-134365)Sam Gross2025-07-011-0/+8
| | | | | The `PyMutex_IsLocked()` function is useful in assertions for verifying that code maintains certain locking invariants.
* gh-134280: Disable constant folding for ~ with a boolean argument (GH-134982)Serhiy Storchaka2025-07-011-0/+4
| | | | This moves the deprecation warning from compile time to run time.
* gh-136125: Use `_PyObject_GetMethodStackRef` for `LOAD_ATTR` (GH-136127)Ken Jin2025-07-015-31/+28
|