summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
* gh-113054: Compiler no longer replaces a redundant jump with no line number ↵Irit Katriel2023-12-191-1/+16
| | | | by a NOP (#113139)
* gh-112535: Implement fallback implementation of _Py_ThreadId() (gh-113185)Donghee Na2023-12-181-0/+14
| | | | | --------- Co-authored-by: Sam Gross <colesbury@gmail.com>
* GH-111485: Break up instructions with unused cache entries into component ↵Mark Shannon2023-12-181-0/+71
| | | | micro-ops (GH-113169)
* GH-111485: Test the new cases generator (GH-113252)Mark Shannon2023-12-182-28/+28
|
* gh-111964: Add _PyRWMutex a "readers-writer" lock (gh-112859)Sam Gross2023-12-161-0/+106
| | | | This adds `_PyRWMutex`, a "readers-writer" lock, which wil be used to serialize global stop-the-world pauses with per-interpreter pauses.
* GH-111485: Mark some instructions as `TIER_ONE_ONLY` (GH-113155)Brandt Bucher2023-12-153-139/+14
|
* GH-112354: Treat _EXIT_TRACE like an unconditional side exit (GH-113104)Mark Shannon2023-12-144-21/+4
|
* gh-112716: Fix SystemError when __builtins__ is not a dict (GH-112770)Serhiy Storchaka2023-12-141-2/+2
| | | | | | It was raised in two cases: * in the import statement when looking up __import__ * in pickling some builtin type when looking up built-ins iter, getattr, etc.
* Fix whitespace in generated codeMark Shannon2023-12-131-6/+6
|
* gh-76785: Avoid Pickled TracebackException for Propagated Subinterpreter ↵Eric Snow2023-12-131-151/+88
| | | | | Exceptions (gh-113036) We need the TracebackException of uncaught exceptions for a single purpose: the error display. Thus we only need to pass the formatted error display between interpreters. Passing a pickled TracebackException is overkill.
* gh-112723: Call `PyThreadState_Clear()` from the correct interpreter (#112776)Sam Gross2023-12-133-53/+30
| | | | | | | | | | | | | The `PyThreadState_Clear()` function must only be called with the GIL held and must be called from the same interpreter as the passed in thread state. Otherwise, any Python objects on the thread state may be destroyed using the wrong interpreter, leading to memory corruption. This is also important for `Py_GIL_DISABLED` builds because free lists will be associated with PyThreadStates and cleared in `PyThreadState_Clear()`. This fixes two places that called `PyThreadState_Clear()` from the wrong interpreter and adds an assertion to `PyThreadState_Clear()`.
* gh-76785: Show the Traceback for Uncaught Subinterpreter Exceptions (gh-113034)Eric Snow2023-12-131-12/+206
| | | When an exception is uncaught in Interpreter.exec_sync(), it helps to show that exception's error display if uncaught in the calling interpreter. We do so here by generating a TracebackException in the subinterpreter and passing it between interpreters using pickle.
* gh-112320: Implement on-trace confidence tracking for branches (#112321)Guido van Rossum2023-12-122-3/+18
| | | We track the confidence as a scaled int.
* gh-113010: Don't decrement deferred in pystats (#113032)Michael Droettboom2023-12-121-4/+0
| | | This fixes a recently introduced bug where the deferred count is being unnecessarily decremented to counteract an increment elsewhere that is no longer happening. This caused the values to flip around to "very large" 64-bit numbers.
* GH-108866: Guarantee forward progress in executors. (GH-113006)Mark Shannon2023-12-123-18/+13
|
* gh-76785: Fixes for test.support.interpreters (gh-112982)Eric Snow2023-12-123-1/+69
| | | This involves a number of changes for PEP 734.
* GH-111485: Factor out tier 2 code generation from the rest of the ↵Mark Shannon2023-12-123-731/+893
| | | | interpreter code generator (GH-112968)
* gh-112970: Detect and use closefrom() when available (#112969)Sam James2023-12-121-3/+3
| | | | | | | | | | | glibc-2.34 implements closefrom(3) using the same semantics as on BSD. Check for closefrom() in configure and use the check result in fileutils.c, rather than hardcoding a FreeBSD check. Some implementations of closefrom() return an int. Explicitly discard the return value by casting it to void, to avoid future compiler warnings. Signed-off-by: Sam James <sam@gentoo.org>
* A smattering of cleanups in uop debug output and lltrace (#112980)Guido van Rossum2023-12-123-10/+11
| | | | | | * Include destination T1 opcode in Error debug message * Include destination T1 opcode in DEOPT debug message * Remove obsolete comment from remove_unneeded_uops * Change lltrace_instruction() to print caller's opcode/oparg
* gh-112978: Remove redundant condition inside `take_gil` (gh-112979)Yan Yanchii2023-12-111-5/+0
|
* gh-90350: Optimize builtin functions min() and max() (GH-30286)colorfulappl2023-12-111-36/+45
| | | | Builtin functions min() and max() now use METH_FASTCALL
* gh-112943: Correctly compute end offsets for multiline tokens in the ↵Pablo Galindo Salgado2023-12-111-1/+1
| | | | tokenize module (#112949)
* gh-111924: Use PyMutex for Runtime-global Locks. (gh-112207)Sam Gross2023-12-076-182/+41
| | | | | This replaces some usages of PyThread_type_lock with PyMutex, which does not require memory allocation to initialize. This simplifies some of the runtime initialization and is also one step towards avoiding changing the default raw memory allocator during initialize/finalization, which can be non-thread-safe in some circumstances.
* gh-112538: Add internal-only _PyThreadStateImpl "wrapper" for PyThreadState ↵Sam Gross2023-12-071-14/+14
| | | | | | | | (gh-112560) Every PyThreadState instance is now actually a _PyThreadStateImpl. It is safe to cast from `PyThreadState*` to `_PyThreadStateImpl*` and back. The _PyThreadStateImpl will contain fields that we do not want to expose in the public C API.
* gh-111962: Make dtoa thread-safe in `--disable-gil` builds. (#112049)Sam Gross2023-12-072-25/+59
| | | | | | | | | | | | | | | | | | | | This updates `dtoa.c` to avoid using the Bigint free-list in --disable-gil builds and to pre-computes the needed powers of 5 during interpreter initialization. * gh-111962: Make dtoa thread-safe in `--disable-gil` builds. This avoids using the Bigint free-list in `--disable-gil` builds and pre-computes the needed powers of 5 during interpreter initialization. * Fix size of cached powers of 5 array. We need the powers of 5 up to 5**512 because we only jump straight to underflow when the exponent is less than -512 (or larger than 308). * Rename Py_NOGIL to Py_GIL_DISABLED * Changes from review * Fix assertion placement
* GH-111485: Separate out parsing, analysis and code-gen phases of tier 1 code ↵Mark Shannon2023-12-074-516/+541
| | | | generator (GH-112299)
* gh-74616: Raise ValueError in case of null character in input prompt (GH-1738)Kushal Das2023-12-071-0/+5
| | | | | | | If the input prompt to the builtin input function on terminal has any null character, then raise ValueError instead of silently truncating it. Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* gh-112660: Do not clear arbitrary errors on import (GH-112661)Serhiy Storchaka2023-12-072-26/+45
| | | | | Previously arbitrary errors could be cleared during formatting error messages for ImportError or AttributeError for modules. Now all unexpected errors are reported.
* gh-112730: Use color to highlight error locations (gh-112732)Pablo Galindo Salgado2023-12-061-0/+2
| | | | Signed-off-by: Pablo Galindo <pablogsal@gmail.com> Co-authored-by: Łukasz Langa <lukasz@langa.pl>
* gh-111545: Add Py_HashPointer() function (#112096)Victor Stinner2023-12-062-18/+6
| | | | | * Implement _Py_HashPointerRaw() as a static inline function. * Add Py_HashPointer() tests to test_capi.test_hash. * Keep _Py_HashPointer() function as an alias to Py_HashPointer().
* gh-112606: Use sem_clockwait with monotonic time when supported in ↵Matt Prodani2023-12-061-2/+11
| | | | parking_lot.c (gh-112733)
* gh-65210: Add const qualifiers in PyArg_VaParseTupleAndKeywords() (GH-105958)Serhiy Storchaka2023-12-041-8/+9
| | | | | | | | | | | Change the declaration of the keywords parameter in functions PyArg_ParseTupleAndKeywords() and PyArg_VaParseTupleAndKeywords() from `char **` to `char * const *` in C and `const char * const *` in C++. It makes these functions compatible with argument of type `const char * const *`, `const char **` or `char * const *` in C++ and `char * const *` in C without explicit type cast. Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
* bpo-34392: Add sys. _is_interned() (GH-8755)Serhiy Storchaka2023-12-042-1/+53
|
* gh-106560: Fix redundant declarations in Python/frozen.c (#112612)Victor Stinner2023-12-031-6/+0
| | | | | | Avoid duplicated declarations of "extern" functions in Python/frozen.c. Compiler warnings seen by building Python with gcc -Wredundant-decls.
* gh-112567: Add _PyTimeFraction C API (#112568)Victor Stinner2023-12-011-65/+85
| | | | | | | | | | | | | | | | | | | | | Use a fraction internally in the _PyTime API to reduce the risk of integer overflow: simplify the fraction using Greatest Common Divisor (GCD). The fraction API is used by time functions: perf_counter(), monotonic() and process_time(). For example, QueryPerformanceFrequency() usually returns 10 MHz on Windows 10 and newer. The fraction SEC_TO_NS / frequency = 1_000_000_000 / 10_000_000 can be simplified to 100 / 1. * Add _PyTimeFraction type. * Add functions: * _PyTimeFraction_Set() * _PyTimeFraction_Mul() * _PyTimeFraction_Resolution() * No longer check "numer * denom <= _PyTime_MAX" in _PyTimeFraction_Set(). _PyTimeFraction_Mul() uses _PyTime_Mul() which handles integer overflow.
* gh-112567: Add _Py_GetTicksPerSecond() function (#112587)Victor Stinner2023-12-012-5/+24
| | | | | | | | | | * Move _PyRuntimeState.time to _posixstate.ticks_per_second and time_module_state.ticks_per_second. * Add time_module_state.clocks_per_second. * Rename _PyTime_GetClockWithInfo() to py_clock(). * Rename _PyTime_GetProcessTimeWithInfo() to py_process_time(). * Add process_time_times() helper function, called by py_process_time(). * os.times() is now always built: no longer rely on HAVE_TIMES.
* gh-112367: Only free perf trampoline arenas at shutdown (#112368)Pablo Galindo Salgado2023-12-012-6/+36
| | | Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
* gh-112519: Make it possible to specify instruction flags for pseudo ↵Irit Katriel2023-11-302-4/+4
| | | | instructions in bytecodes.c (#112520)
* gh-111972: Make Unicode name C APIcapsule initialization thread-safe (#112249)Kirill Podoprigora2023-11-301-9/+3
|
* Rename ...Uop... to ...UOp... (uppercase O) for consistency (#112327)Guido van Rossum2023-11-294-22/+22
| | | | * Rename _PyUopExecute to _PyUOpExecute (uppercase O) for consistency * Also rename _PyUopName and _PyUOp_Replacements, and some output strings
* gh-112217: Add check to call result for `do_raise()` where cause is a type. ↵apaz2023-11-271-0/+7
| | | | (#112216)
* gh-111789: Use PyDict_GetItemRef() in Python/_warnings.c (gh-112080)Serhiy Storchaka2023-11-271-4/+4
|
* gh-111789: Use PyDict_GetItemRef() in Python/symtable.c (gh-112084)Serhiy Storchaka2023-11-271-8/+4
|
* gh-111789: Use PyDict_GetItemRef() in Python/codecs.c (gh-112082)Serhiy Storchaka2023-11-271-5/+4
|
* gh-111789: Use PyDict_GetItemRef() in Python/bltinmodule.c (gh-112081)Serhiy Storchaka2023-11-271-6/+3
|
* gh-112438: Fix support of format units with the "e" prefix in nested tuples ↵Serhiy Storchaka2023-11-271-1/+1
| | | | in PyArg_Parse (gh-112439)
* gh-99606: Make code generated for an empty f-string identical to that of a ↵Irit Katriel2023-11-261-2/+6
| | | | normal empty string (#112407)
* gh-76785: Return an "excinfo" Object From Interpreter.run() (gh-111573)Eric Snow2023-11-231-125/+323
|
* GH-111485: Sort cases in the case generator output (GH-112315)Mark Shannon2023-11-221-4196/+4196
|
* gh-111786: Use separate opcode vars for Tier 1 and Tier 2 (#112289)Michael Droettboom2023-11-201-12/+11
| | | | This makes Windows about 3% faster on pyperformance benchmarks.