Commit Graph

120804 Commits

Author SHA1 Message Date
Nikita Sobolev
fd2bb4be3d
gh-115498: Fix SET_COUNT error handling in _xxinterpchannelsmodule (#115499) 2024-02-16 00:31:23 +03:00
Thomas Wouters
26f23daa1e Merge branch 'main' of https://github.com/python/cpython 2024-02-15 21:53:06 +01:00
Thomas Wouters
c08c067905 Post 3.13.0a4 2024-02-15 21:52:49 +01:00
Dino Viehland
ae460d450a
gh-113743: Make the MRO cache thread-safe in free-threaded builds (#113930)
Makes _PyType_Lookup thread safe, including:
    Thread safety of the underlying cache.
    Make mutation of mro and type members thread safe
    Also _PyType_GetMRO and _PyType_GetBases are currently returning borrowed references which aren't safe.
2024-02-15 10:54:57 -08:00
Erlend E. Aasland
e74fa294c9
gh-113317: Argument Clinic: inline required_type_for_self_for_parser() in self converter (#115522)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-02-15 16:03:58 +00:00
Hugo van Kemenade
cfb26401f6
gh-100734: What's New in 3.x: Add missing detail from 3.x branch (#114689) 2024-02-15 17:32:33 +02:00
monkeyman192
298bcdc185
gh-112433: Add optional _align_ attribute to ctypes.Structure (GH-113790) 2024-02-15 16:40:20 +02:00
Irit Katriel
f42e112fd8
gh-115420: Fix translation of exception hander targets by _testinternalcapi.optimize_cfg. (#115425) 2024-02-15 14:32:52 +00:00
Irit Katriel
3a9e67a9fd
gh-115376: fix segfault in _testinternalcapi.compiler_codegen on bad input (#115379) 2024-02-15 14:32:21 +00:00
Victor Stinner
94f1334e52
gh-115124: Use _PyObject_ASSERT() in gc.c (#115125)
Replace assert() with _PyObject_ASSERT() in gc.c to dump the object
when an assertion fails.
2024-02-15 14:29:42 +00:00
Irit Katriel
732faf17a6
gh-115347: avoid emitting redundant NOP for the docstring with -OO (#115494) 2024-02-15 14:20:19 +00:00
Thomas Wouters
9d34f60783 Python 3.13.0a4 2024-02-15 14:38:42 +01:00
Sam Gross
ad4f909e0e
gh-115432: Add critical section variant that handles a NULL object (#115433)
This adds `Py_XBEGIN_CRITICAL_SECTION` and
`Py_XEND_CRITICAL_SECTION`, which accept a possibly NULL object as an
argument. If the argument is NULL, then nothing is locked or unlocked.
Otherwise, they behave like `Py_BEGIN/END_CRITICAL_SECTION`.
2024-02-15 08:37:54 -05:00
T. Wouters
b0e5c35ded
gh-115490: Work around test.support.interpreters.channels not handling unloading (#115515)
Work around test.support.interpreters.channels not handling unloading, which
regrtest does when running tests sequentially, by explicitly skipping the
unloading of test.support.interpreters and its submodules.

This can be rolled back once test.support.interpreters.channels supports
unloading, if we are keeping sequential runs in the same process around.
2024-02-15 14:24:13 +01:00
Erlend E. Aasland
a0149fa6cf
gh-113317: Argument Clinic: remove global clinic instance (#115517) 2024-02-15 13:21:31 +00:00
Erlend E. Aasland
7f074a771b
gh-113317: Argument Clinic: don't use global state in warn() and fail() (#115510) 2024-02-15 13:22:21 +01:00
Erlend E. Aasland
98ee4ecdbc
gh-113317: Argument Clinic: don't use fail() in CLI (#115513) 2024-02-15 12:10:32 +00:00
Martijn Pieters
edb59d5718
bpo-38364: unwrap partialmethods just like we unwrap partials (#16600)
* bpo-38364: unwrap partialmethods just like we unwrap partials

The inspect.isgeneratorfunction, inspect.iscoroutinefunction and inspect.isasyncgenfunction already unwrap functools.partial objects, this patch adds support for partialmethod objects as well.

Also: Rename _partialmethod to __partialmethod__.
Since we're checking this attribute on arbitrary function-like objects,
we should use the namespace reserved for core Python.

---------

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-02-15 12:08:45 +01:00
David Hewitt
9e3729bbd7
gh-114626: add PyCFunctionFast and PyCFunctionFastWithKeywords (GH-114627)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-02-15 11:05:20 +01:00
Erlend E. Aasland
32f8ab1ab6
gh-114258: Refactor Argument Clinic function name parser (#114930)
Refactor state_modulename_name() of the parsing state machine, by
adding helpers for the sections that deal with ...:

1. parsing the function name
2. normalizing "function kind"
3. dealing with cloned functions
4. resolving return converters
5. adding the function to the DSL parser
2024-02-15 09:45:21 +01:00
mpage
dc978f6ab6
gh-112050: Make collections.deque thread-safe in free-threaded builds (#113830)
Use critical sections to make deque methods that operate on mutable 
state thread-safe when the GIL is disabled. This is mostly accomplished
by using the @critical_section Argument Clinic directive, though there
are a few places where this was not possible and critical sections had
to be manually acquired/released.
2024-02-15 09:22:47 +01:00
Ned Batchelder
474204765b
docs: use consistent .append() in dis.rst (#115434)
The STACK variable is described as like a Python list, so pushing to it should be done with .append() consistently throughout.
2024-02-15 02:14:03 -05:00
Ken Jin
4ebf8fbdab
gh-115480: Type and constant propagation for int BINARY_OPs (GH-115478) 2024-02-15 14:02:18 +08:00
Ken Jin
ed23839dc5
Trigger JIT CI with optimizer files (#115483)
* Trigger JIT CI with optimizer files
2024-02-15 14:01:24 +08:00
Brett Cannon
18343c0985
GH-113516: don't set LDSHARED when building for WASI (GH-115495) 2024-02-15 00:51:23 +00:00
Eric Snow
468430189d
gh-115482: Assume the Main Interpreter is Always Running "main" (gh-115484)
This is a temporary fix to unblock embedders that do not call Py_Main().

_PyInterpreterState_IsRunningMain() will always return true for the main interpreter, even in corner cases where it technically should not. The (future) full solution will do the right thing in those corner cases.
2024-02-14 16:07:22 -07:00
Victor Stinner
3e7b7df5cb
gh-114570: Add PythonFinalizationError exception (#115352)
Add PythonFinalizationError exception. This exception derived from
RuntimeError is raised when an operation is blocked during the Python
finalization.

The following functions now raise PythonFinalizationError, instead of
RuntimeError:

* _thread.start_new_thread()
* subprocess.Popen
* os.fork()
* os.fork1()
* os.forkpty()

Morever, _winapi.Overlapped finalizer now logs an unraisable
PythonFinalizationError, instead of an unraisable RuntimeError.
2024-02-14 23:35:06 +01:00
Sam Gross
326119d373
gh-112529: Use _PyThread_Id() in mimalloc in free-threaded build (#115488)
The free-threaded GC uses mimallocs segment thread IDs to restore
the overwritten `ob_tid` thread ids in PyObjects. For that reason, it's
important that PyObjects and mimalloc use the same identifiers.
2024-02-14 16:41:29 -05:00
mpage
a95b1a56bb
gh-115041: Add wrappers that are atomic only in free-threaded builds (#115046)
These are intended to be used in places where atomics are required in
free-threaded builds but not in the default build. We don't want to
introduce the potential performance overhead of an atomic operation in the
default build.
2024-02-14 15:15:05 -05:00
Ken Jin
d9f4cbe5e1
Add myself to various CODEOWNERS (GH-115481) 2024-02-15 03:48:11 +08:00
Seth Michael Larson
889cc43cb1
gh-112302: Move pip SBOM discovery to release-tools (#115360) 2024-02-14 12:47:15 -07:00
Erlend E. Aasland
49e8fdc1df
Docs: spell out sentence about ndbm/gdbm file formats (#115470) 2024-02-14 19:03:20 +01:00
Sam Gross
17773fcb86
gh-115441: Fix missing braces warning (#115460)
Removes `_py_object_state_INIT`. We want to initialize the `object_state` field to zero.
2024-02-14 12:27:39 -05:00
Donghee Na
a2d4281415
gh-112087: Make __sizeof__ and listiter_{len, next} to be threadsafe (gh-114843) 2024-02-15 02:00:50 +09:00
Seth Michael Larson
4b2d1786cc
gh-115399: Upgrade bundled libexpat to 2.6.0 (#115431) 2024-02-14 16:29:06 +00:00
kcatss
671360161f
gh-115243: Fix crash in deque.index() when the deque is concurrently modified (GH-115247) 2024-02-14 16:08:26 +00:00
Erlend E. Aasland
81e140d10b
Docs: reword sentences about dbm submodule traits (#114609)
Don't repeatedly say that keys and values are coerced into bytes.
2024-02-14 16:36:13 +01:00
Brian Schubert
bb791c7728
gh-115392: Fix doctest reporting incorrect line numbers for decorated functions (#115440) 2024-02-14 15:01:27 +00:00
Stanislav Lyu
6755c4e0c8
gh-115403: Remove extra colon after "Examples" in datetime documentation (#115452) 2024-02-14 13:52:42 +00:00
Erlend E. Aasland
6d9141ed76
gh-100414: Make dbm.sqlite3 the preferred dbm backend (#115447) 2024-02-14 13:47:19 +00:00
Nikita Sobolev
ec8909a239
gh-115450: Fix direct invocation of test_desctut (#115451) 2024-02-14 16:31:28 +03:00
Erlend E. Aasland
029ec91d43
gh-100414: Skip test_dbm_sqlite3 if sqlite3 is unavailable (#115449)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-02-14 13:16:09 +00:00
Erlend E. Aasland
dd5e4d9078
gh-100414: Add SQLite backend to dbm (#114481)
Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2024-02-14 11:14:56 +00:00
Ken Jin
57e4c81ae1
gh-114058: Fix flaky globals to constant test (#115423)
Co-authored-by: Victor Stinner <vstinner@python.org>
2024-02-14 12:12:52 +01:00
Alex Waygood
3fd2ad8241
ftplib docs: timeout doesn't have to be a whole number (#115443) 2024-02-14 10:41:17 +00:00
Hugo van Kemenade
46245b0d83
Docs: Use substitutions instead of manual version updates (#115416) 2024-02-13 23:55:00 -07:00
Donghee Na
f15795c9a0
gh-111968: Rename freelist related struct names to Eric's suggestion (gh-115329) 2024-02-14 00:32:51 +00:00
T. Wouters
518af37eb5
gh-115421: Update the list of installed test subdirectories. (#115422)
Update the list of installed test subdirectories with all newly added
subdirectories of Lib/test, so that the tests in those directories are
properly installed.
2024-02-14 00:58:49 +01:00
Eric Snow
514b1c91b8
gh-76785: Improved Subinterpreters Compatibility with 3.12 (gh-115424)
For the most part, these changes make is substantially easier to backport subinterpreter-related code to 3.12, especially the related modules (e.g. _xxsubinterpreters). The main motivation is to support releasing a PyPI package with the 3.13 capabilities compiled for 3.12.

A lot of the changes here involve either hiding details behind macros/functions or splitting up some files.
2024-02-13 14:56:49 -07:00
Kirill Podoprigora
206f73dc5f
gh-115391: Fix compiler warning in Objects/longobject.c (GH-115368) 2024-02-13 20:49:13 +00:00