summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
...
* 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.
* gh-112287: Speed up Tier 2 (uop) interpreter a little (#112286)Guido van Rossum2023-11-203-31/+124
| | | | | | | | | | | | | | | | | | | | | | | | | | This makes the Tier 2 interpreter a little faster. I calculated by about 3%, though I hesitate to claim an exact number. This starts by doubling the trace size limit (to 512), making it more likely that loops fit in a trace. The rest of the approach is to only load `oparg` and `operand` in cases that use them. The code generator know when these are used. For `oparg`, it will conditionally emit ``` oparg = CURRENT_OPARG(); ``` at the top of the case block. (The `oparg` variable may be referenced multiple times by the instructions code block, so it must be in a variable.) For `operand`, it will use `CURRENT_OPERAND()` directly instead of referencing the `operand` variable, which no longer exists. (There is only one place where this will be used.)
* gh-111848: Clean up RESERVE() macro (#112274)Guido van Rossum2023-11-201-14/+9
| | | Also avoid compiler warnings about unused 'reserved' variable.
* gh-106529: Make FOR_ITER a viable uop (#112134)Guido van Rossum2023-11-205-4/+60
| | | | | | | | | | This uses the new mechanism whereby certain uops are replaced by others during translation, using the `_PyUop_Replacements` table. We further special-case the `_FOR_ITER_TIER_TWO` uop to update the deoptimization target to point just past the corresponding `END_FOR` opcode. Two tiny code cleanups are also part of this PR.
* gh-111863: Rename `Py_NOGIL` to `Py_GIL_DISABLED` (#111864)Hugo van Kemenade2023-11-203-5/+5
| | | Rename Py_NOGIL to Py_GIL_DISABLED
* gh-112234: Remove the toplevel parameter in converttuple() (GH-112235)Serhiy Storchaka2023-11-181-16/+6
| | | It is and always was 0.
* gh-110319: Assert type_version != 0 before using it (#112226)Guido van Rossum2023-11-182-4/+4
| | | | | | - Ensure that `assert(type_version != 0);` always comes *before* using `type_version` Also: - In cases_generator, rename `-v` to from `--verbose` to `--viable`
* Various small improvements to uop debug output (#112218)Guido van Rossum2023-11-172-13/+20
| | | | | - Show uop name in Error/DEOPT messages - Add target to some messages - Expose uop_name() as _PyUopName()
* gh-106529: Cleanups split off gh-112134 (#112214)Guido van Rossum2023-11-173-1/+22
| | | | | | | - Double max trace size to 256 - Add a dependency on executor_cases.c.h for ceval.o - Mark `_SPECIALIZE_UNPACK_SEQUENCE` as `TIER_ONE_ONLY` - Add debug output back showing the optimized trace - Bunch of cleanups to Tools/cases_generator/
* gh-111956: Add thread-safe one-time initialization. (gh-111960)Sam Gross2023-11-164-901/+941
|
* GH-111848: Set the IP when de-optimizing (GH-112065)Mark Shannon2023-11-153-38/+34
| | | | | | | | | | | | * Replace jumps with deopts in tier 2 * Fewer special cases of uop names * Add target field to uop IR * Remove more redundant SET_IP and _CHECK_VALIDITY micro-ops * Extend whitelist of non-escaping API functions.
* GH-111848: Convert remaining jumps to deopts into tier 2 code. (GH-112045)Mark Shannon2023-11-145-69/+92
|
* gh-111789: Simplify bytecodes.c by using PyDict_GetItemRef() (GH-111978)Serhiy Storchaka2023-11-143-140/+51
|
* gh-111262: Add PyDict_Pop() function (#112028)Victor Stinner2023-11-142-5/+3
| | | | | | | _PyDict_Pop_KnownHash(): remove the default value and the return type becomes an int. Co-authored-by: Stefan Behnel <stefan_ml@behnel.de> Co-authored-by: Antoine Pitrou <pitrou@free.fr>
* gh-111789: Simplify ceval.c by using PyDict_GetItemRef() (GH-111980)Serhiy Storchaka2023-11-141-18/+14
|
* gh-111789: Simplify import.c by using PyDict_GetItemRef() (GH-111979)Serhiy Storchaka2023-11-141-18/+17
|
* GH-111520: Add back the operand local (GH-111813)Brandt Bucher2023-11-142-27/+23
|
* gh-107149: make new opcode util functions private rather than public and ↵Irit Katriel2023-11-142-10/+11
| | | | unstable (#112042)
* gh-111856: Fix os.fstat on windows with FAT32 and exFAT filesystem (GH-112038)AN Long2023-11-131-3/+8
|
* gh-106905: avoid incorrect SystemError about recursion depth mismatch (#106906)Markus Mohrhard2023-11-131-0/+14
| | | | | | | | | | * gh-106905: avoid incorrect SystemError about recursion depth mismatch * Update Misc/NEWS.d/next/Core and Builtins/2023-07-20-11-41-16.gh-issue-106905.AyZpuB.rst --------- Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com> Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* gh-111999: Add signatures and improve docstrings for builtins (GH-112000)Serhiy Storchaka2023-11-131-9/+13
|
* gh-111933: fix broken link to A.Neumaier article (gh-111937)Sergey B Kirpichev2023-11-121-1/+4
|
* Remove dead code left after gh-110721 (#111905)Serhiy Storchaka2023-11-101-37/+0
|
* gh-81925: Implement native thread ids for kFreeBSD (#111761)Samuel Thibault2023-11-091-0/+5
| | | | | --------- Co-authored-by: Antoine Pitrou <antoine@python.org>