Commit Graph

9626 Commits

Author SHA1 Message Date
Bénédikt Tran 3fa024dec3
gh-132909: handle overflow for `'K'` format in `do_mkvalue` (#132911) 2025-04-25 11:02:57 +00:00
Victor Stinner c292f7f563
gh-127604: Only define dump_pointer() if CAN_C_BACKTRACE (#132897) 2025-04-25 09:28:34 +02:00
Pablo Galindo Salgado 22c9886c8e
gh-131591: Implement PEP 768 support for FAT mac binaries and 32 bit binaries (#132892)
Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
2025-04-25 01:58:19 +01:00
Eric Snow e54e828852
gh-132776: Cleanup for XIBufferViewType (gh-132821)
* add notes
* rename XIBufferViewObject to xibufferview
* move memoryview XIData code to memoryobject.c
2025-04-24 18:25:29 -06:00
Tomas R. 08e3389e8c
GH-131798: Split up and optimize CALL_TUPLE_1 in the JIT (GH-132851) 2025-04-24 15:55:03 -07:00
Tomas R. 0a387b311e
GH-131798: Split up and optimize CALL_STR_1 in the JIT (GH-132849) 2025-04-24 12:54:46 -07:00
Matt Wozniski a94c7528b5
gh-132859: Run debugger scripts in their own namespaces (#132860)
Run debugger scripts in their own namespaces

Previously scripts injected by `sys.remote_exec` were run with the
globals of the `__main__` module. Instead, run each injected script
with an empty set of globals. If someone really wants to use the
`__main__` module's namespace, they can always `import __main__`.
2025-04-23 23:40:24 +00:00
Victor Stinner 402dba2928
gh-127604: Replace dprintf() with _Py_write_noraise() (#132854) 2025-04-23 20:02:25 +00:00
Pablo Galindo Salgado 99b13775da
gh-131591: Check for remote debug in PyErr_CheckSignals (#132853)
For the same reasons as running the GC, this will allow sections that
run in native code for long periods without executing bytecode to also
run the remote debugger protocol without having to wait until bytecode
is executed

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
2025-04-23 20:59:41 +01:00
Pablo Galindo Salgado 1007aab133
gh-127604: Allow faulthandler to dumpC stack on MacOS (#132841) 2025-04-23 18:23:24 +01:00
Ken Jin 6430c634da
gh-132758: Fix tail call and pystats builds (GH-132759) 2025-04-23 18:17:35 +08:00
Tomas R. a6a3dbb7db
GH-131798: JIT: Split CALL_TYPE_1 into several uops (GH-132419) 2025-04-22 09:30:38 -07:00
Jelle Zijlstra 01317bb449
gh-132479: Fix crash with multiple comprehensions in annotations (#132778) 2025-04-21 13:49:59 -07:00
Sam Gross da53660f35
gh-131586: Avoid refcount contention in context managers (gh-131851)
This avoid reference count contention in the free threading build
when calling special methods like `__enter__` and `__exit__`.
2025-04-21 15:54:25 -04:00
Peter Bierma 8dfa840773
gh-127604: Add C stack dumps to `faulthandler` (#128159) 2025-04-21 20:48:02 +01:00
Brandt Bucher 4f7f72ce34
GH-130415: Improve the JIT's unneeded uop removal pass (GH-132333) 2025-04-21 09:58:55 -07:00
Bénédikt Tran 427e7fc099
gh-132399: ensure correct alignment of `PyInterpreterState` (#132428) 2025-04-19 11:03:06 +02:00
Bénédikt Tran 8a9c6c4d16
gh-128398: improve error messages when incorrectly using `with` and `async with` (#132218)
Improve the error message with a suggestion when an object supporting the synchronous
(resp. asynchronous) context manager protocol is entered using `async with` (resp. `with`)
instead of `with` (resp. `async with`).
2025-04-19 10:44:01 +02:00
Pablo Galindo Salgado c9a855a9e0
gh-131591: Execute the source and not the file to avoid locking it in Windows (#132712)
Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
2025-04-19 00:38:12 +00:00
Kumar Aditya 7fd708b727
gh-132685: fix thread safety of `PyMember_GetOne` with `_Py_T_OBJECT` (#132690) 2025-04-18 21:03:42 +05:30
Brandt Bucher 40ae88988c
GH-131498: Replace single-element arrays with scalars in bytecodes.c (GH-132615) 2025-04-18 07:16:28 -07:00
Bénédikt Tran 379352620c
gh-132097: use a macro for semantically casting function pointers (#132406) 2025-04-18 12:24:34 +02:00
Kumar Aditya f3d877a27a
gh-132643: use atomic load for dict in specializer (#132653) 2025-04-18 15:06:27 +05:30
Adam Turner ea23c897cd
Remove duplicate includes: Python/importdl.c (#132623) 2025-04-18 02:49:19 +01:00
Alper 22830103e5
gh-131173: Improve exception handling during take_ownership processing (#132620)
Save and restore exceptions during take_ownership processing to preserve
exceptions currently being raised.

Co-authored-by: alperyoney <alperyoney@fb.com>
2025-04-17 13:38:34 -07:00
Bartosz Sławecki 954b2cf031
gh-130070: Fix `exec(<string>, closure=<non-None>)` unexpected path (#130071)
Fixed an assertion error (so, it could be reproduced only in builds with assertions enabled)
for `exec` when the `source` argument is a string and the `closure` argument is not `None`.

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-04-17 10:14:55 +03:00
Adam Turner d7df7815f5
Remove duplicate includes: Python/ast_opt.c (#132621) 2025-04-17 10:10:01 +03:00
Nadeshiko Manju b9e88ff4cb
gh-131798: Use `sym_new_type` instead of `sym_new_not_null` for `_BUILD_LIST`, `_BUILD_SLICE`, and `_BUILD_MAP` (GH-132434)
---------

Signed-off-by: Manjusaka <me@manjusaka.me>
2025-04-17 01:17:48 +08:00
T. Wouters c66ffcf8e3
gh-129987: Selectively re-enable SLP autovectorization of _PyEval_EvalFrameDefault (#132530)
Only disable SLP autovectorization of `_PyEval_EvalFrameDefault` on newer
GCCs, as the optimization bug seems to exist only on GCC 12 and later, and
before GCC 9 disabling the optimization has a dramatic performance impact.
2025-04-15 09:39:32 +00:00
Serhiy Storchaka 102f825c51
gh-124476: Fix decoding from the locale encoding in the C.UTF-8 locale (GH-132477) 2025-04-14 21:32:41 +03:00
Mark Shannon 844596c09f
GH-131498: Cases generator: Allow input and 'peek' variables to be modified (GH-132506) 2025-04-14 12:19:53 +01:00
Furkan Onder c7f6535e4a
gh-131624: Fix posix_spawn tests failing on NetBSD with stack limit assertions (GH-131625)
Fix recursive limit assertions on NetBSD for posix_spawn.
2025-04-13 14:06:38 +03:00
Tomas R. 3d08c8ad20
gh-131927: Prevent emitting optimizer warnings twice in the REPL (#131993) 2025-04-12 11:34:36 +01:00
Serhiy Storchaka d4e2cdc15b
gh-125434: Fix building on OpenBSD (GH-132393)
pthread_get_name_np is defined in pthread_np.h.
2025-04-12 11:25:35 +03:00
Bénédikt Tran a81232c769
gh-132399: fix invalid function signatures on the free-threaded build (#132400) 2025-04-12 07:46:33 +00:00
Tomas R. e6ef47ac22
gh-132386: Fix a crash when passing a dict subclass to `exec` (GH-132412)
* Fix crash when passing a dict subclass to exec

* Add news entry
2025-04-12 05:05:03 +08:00
Mark Shannon d87e7f3529
GH-127682: Only call `__iter__` once in generator expressions. (GH-132351) 2025-04-11 09:37:22 +01:00
Jelle Zijlstra 07b8d3117f
gh-132261: Store annotations at hidden internal keys in the class dict (#132345) 2025-04-10 21:13:26 -07:00
Chris Eibl e5f68fd29b
GH-131296: Suppress "unused label" warning for clang-cl closer to actual occurrence (GH-131900) 2025-04-10 23:17:33 +01:00
Chu 3d83c1ec61
Fix a typo in Python/pylifecycle.c (#132350) 2025-04-10 17:27:37 +05:30
mpage 619edb802e
gh-132336: Mark a few "slow path" functions used by the interpreter loop as noinline (#132337)
Mark a few functions used by the interpreter loop as noinline

These are all the slow path and should not be inlined into the interpreter
loop. Unfortunately, they end up being inlined with LTO and the current PGO
task.
2025-04-10 10:41:15 +02:00
Neil Schemenauer d687900f98
gh-128384: Use a context variable for warnings.catch_warnings (gh-130010)
Make `warnings.catch_warnings()` use a context variable for holding
the warning filtering state if the `sys.flags.context_aware_warnings`
flag is set to true.  This makes using the context manager thread-safe in
multi-threaded programs.

Add the `sys.flags.thread_inherit_context` flag.  If true, starting a new
thread with `threading.Thread` will use a copy of the context
from the caller of `Thread.start()`.

Both these flags are set to true by default for the free-threaded build
and false for the default build.

Move the Python implementation of warnings.py into _py_warnings.py.

Make _contextvars a builtin module.

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-04-09 16:18:54 -07:00
Brandt Bucher 20926c73b5
GH-131798: Remove JIT guards for dict, frozenset, list, set, and tuple (GH-132289) 2025-04-09 14:32:21 -07:00
mpage 1f5682f3a2
gh-129987: Disable GCC SLP autovectorization for the interpreter loop on x86-64 (#132295)
The SLP autovectorizer can cause poor code generation for opcode dispatch, negating any benefit we get from vectorization elsewhere in the interpreter loop.
2025-04-09 10:34:12 -07:00
Serhiy Storchaka f5f1ac84b3
gh-112068: C API: Add support of nullable arguments in PyArg_Parse (GH-121303) 2025-04-08 22:08:00 +03:00
Nadeshiko Manju d753d8aed7
GH-131798: Narrow the result of _CONTAINS_OP_DICT to bool in the JIT (GH-132269)
Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
2025-04-08 09:12:09 -07:00
Tomas R. 71009cb835
GH-131798: Narrow the result type of _BINARY_OP_SUBSCR_STR_INT to str in the JIT (GH-132153) 2025-04-08 08:22:54 -07:00
Serhiy Storchaka 0e4cf9ce7c
gh-50333: Deprecate support of non-tuple sequences in PyArg_ParseTuple() (GH-128374)
Non-tuple sequences are deprecated as argument for the "(items)" format unit
in PyArg_ParseTuple() and other argument parsing functions if items contains
format units which store borrowed buffer or reference (e.g. "s" and "O").

str and bytearray are no longer accepted as valid sequences.
2025-04-08 14:26:32 +03:00
Peter Bierma ac3c439cdf
gh-131998: Fix `NULL` dereference when using an unbound method descriptor in a specialized code path (#132000)
Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Mark Shannon <mark@hotpy.org>
2025-04-08 10:31:43 +00:00
Irit Katriel 8c9ef8f1f8
gh-100239: more stats for BINARY_OP/SUBSCR specialization (#132230) 2025-04-08 08:50:51 +00:00