9532 Commits

Author SHA1 Message Date
Bénédikt Tran
f65be097ed
gh-111178: fix UBSan failures for _PyExecutorObject (#131610) 2025-03-24 10:53:23 +01:00
Irit Katriel
64906bb223
gh-130080: do not fold match case constants in unoptimized AST (#131577) 2025-03-23 13:50:14 +00:00
Victor Stinner
9962469943
gh-131296: fix clang-cl warning in tracemalloc.c (#131514)
Always set MAX_NFRAME to UINT16_MAX.

Avoid the complicated code which emitted a compiler warning.
2025-03-22 10:38:47 +01:00
Victor Stinner
49fb75c676
gh-131238: Add missing pycore_function.h includes for JIT compiler (#131571) 2025-03-21 23:37:49 +00:00
Dino Viehland
d9411ae3c2
gh-130312: SET_ADD should not lock (#130136)
SET_ADD should not lock
2025-03-21 15:58:32 -07:00
Victor Stinner
7101cba6bf
gh-131238: Move _Py_VISIT_STACKREF() to pycore_stackref.h (#131560)
* Move _Py_VISIT_STACKREF() from pycore_gc.h to pycore_stackref.h.
* Remove pycore_interpframe.h include from pycore_genobject.h.
* Remove now useless includes from C files.
* Add pycore_interpframe_structs.h to Makefile.pre.in and
  pythoncore.vcxproj.
2025-03-21 23:24:14 +01:00
Savannah Ostrowski
b92ee14b80
GH-130415: Optimize constant comparison in JIT builds (GH-131489) 2025-03-21 11:23:12 -07:00
Sam Gross
0de5e0c544
gh-117657: Fix TSAN data race in _PyEval_SetTrace assertion (gh-131561)
The `sys_tracing_threads` variable should be read inside `LOCK_SETUP()`.
2025-03-21 14:22:37 -04:00
Victor Stinner
61317074d4
gh-131238: Add pycore_interpframe_structs.h header (#131553)
Add an explicit include to pycore_interpframe_structs.h in
pycore_runtime_structs.h to fix a dependency cycle.
2025-03-21 17:19:47 +00:00
Sam Gross
4f32516804
gh-128421: Add locking to most frame object functions (gh-131479)
This makes more operations on frame objects thread-safe in the free
threaded build, which fixes some data races that occurred when passing
exceptions between threads.

However, accessing local variables from another thread while its running
is still not thread-safe and may crash the interpreter.
2025-03-21 11:10:07 -04:00
Bénédikt Tran
883c2f682b
GH-131331: Rename "not" to "invert" (GH-131334) 2025-03-20 16:59:41 -07:00
Chris Eibl
a2ea417578
GH-131296: fix clang-cl warnings in sysmodule.c (#131304) 2025-03-20 16:29:21 +00:00
Mark Shannon
7ebd71ee14
GH-131498: Remove conditional stack effects (GH-131499)
* Adds some missing #includes
2025-03-20 15:39:38 +00:00
Mark Shannon
83d54fa876
GH-130296: Remove _PyOpcode_max_stack_effect as it is no longer used (GH-131493) 2025-03-20 11:42:54 +00:00
Victor Stinner
b69da006a4
gh-131238: Remove includes from pycore_interp.h (#131495)
Remove also now unused includes in C files.
2025-03-20 11:35:23 +00:00
Victor Stinner
34c1ea3109
gh-111178: Fix function signatures for multiple tests (#131496) 2025-03-20 12:27:03 +01:00
Victor Stinner
486d537065
Fix Windows build warnings (#131487)
Fix the following warnings:

* Modules\_io\fileio.c(1296,13): unused variable 'self'
* Modules\_io\winconsoleio.c(334,9): unused variable 'fd_is_own'
* Modules\faulthandler.c(409,11): unused variable 'flags'
* Modules\posixmodule.c(5699,9): unused variable 'pathError'
* PC\winreg.c(2077,5): suggest braces around initialization of
  subobject
* PC\winreg.c(34,13): unused variable 'errNotAHandle'
* Python\fileutils.c(132,12): result of comparison of constant
  1114111 with expression of type 'wchar_t' (aka 'unsigned short') is
  always false
* Python\fileutils.c(58,21): unused variable 'INCOMPLETE_CHARACTER'
* Python\sysmodule.c(2534,21): unused variable 'perf_map_state'
2025-03-20 12:03:20 +01:00
Kumar Aditya
39b37b0110
gh-128421: add critical section around traceback.tb_next (#131322) 2025-03-20 12:03:54 +05:30
Kumar Aditya
b12af0a48f
gh-131401: fix data races in exception handling (#131447) 2025-03-20 12:02:05 +05:30
Victor Stinner
20c5f969dd
gh-131238: Remove more includes from pycore_interp.h (#131480) 2025-03-19 23:01:32 +01:00
Yan Yanchii
75103d975c
gh-126835: Move constant tuple folding from ast_opt to CFG (#130769) 2025-03-19 20:59:55 +00:00
Diego Russo
8a33034d82
GH-130956: Only emit AArch64 trampolines for long jumps (GH-131041) 2025-03-19 12:19:21 -07:00
Victor Stinner
22706843e0
gh-131238: Remove many includes from pycore_interp.h (#131472) 2025-03-19 17:46:24 +00:00
Victor Stinner
5c44d7d99c
gh-130931: Add pycore_interpframe.h internal header (#131249)
Move _PyInterpreterFrame and associated functions
to a new pycore_interpframe.h header.
2025-03-19 18:17:44 +01:00
Victor Stinner
4b54031323
gh-131238: Remove pycore_runtime.h from pycore_pystate.h (#131356)
* Remove includes from pycore_pystate.h:

  * pycore_runtime_structs.h
  * pycore_runtime.h
  * pycore_tstate.h
  * pycore_interp.h

* Reorganize internal headers. Move _gc_thread_state from
  pycore_interp_structs.h to pycore_tstate.h.
* Add 3 new header files to PCbuild/pythoncore.vcxproj.
2025-03-19 17:33:24 +01:00
Victor Stinner
0a54bd6dd7
gh-111178: Fix function signatures in legacy_tracing.c (#131464) 2025-03-19 16:54:41 +01:00
Victor Stinner
bbe5baad6c
gh-111178: Fix function signatures for test_types (#131455) 2025-03-19 13:46:17 +00:00
Kumar Aditya
74b87515a7
gh-131401: fix data race in _PyErr_Restore (#131406) 2025-03-19 14:35:47 +05:30
Irit Katriel
ffc2f1dd1c
gh-130080: implement PEP 765 (#130087) 2025-03-17 20:48:54 +00:00
Ken Jin
b2ed7a6d6a
gh-131281: Add include for pystats builds (#131369)
Add include to for pystats builds
2025-03-18 00:36:06 +08:00
Mark Shannon
a45f25361d
GH-131238: More refactoring of core header files (GH-131351)
Adds new pycore_stats.h header file to help break dependencies involving the pycore_code.h header.
2025-03-17 14:41:05 +00:00
Victor Stinner
978e37bb5f
gh-131238: Add explicit includes to pycore headers (#131257) 2025-03-17 12:32:43 +01:00
Victor Stinner
0453e494b6
gh-131238: Convert pycore_pystate.h static inline to functions (#131352)
Convert static inline functions to functions:

* _Py_IsMainThread()
* _PyInterpreterState_Main()
* _Py_IsMainInterpreterFinalizing()
* _Py_GetMainConfig()
2025-03-17 12:31:55 +01:00
Mark Shannon
a1aeec61c4
GH-131238: Core header refactor (GH-131250)
* Moves most structs in pycore_ header files into pycore_structs.h and pycore_runtime_structs.h

* Removes many cross-header dependencies
2025-03-17 09:19:04 +00:00
Chris Eibl
f104c19a94
GH-131296: fix clang-cl warning on Windows in pytime.c (GH-131297)
fix warning : integer literal is too large

to be represented in a signed integer type,
interpreting as unsigned [-Wimplicitly-unsigned-literal]
2025-03-15 11:41:34 -07:00
Xuanteng Huang
1821f8f10c
gh-131281: fix compile error due to BINARY_SUBSCR (GH-131283)
* fix compile error due to `BINARY_SUBSCR`

* replace stat_inc with `BINARY_OP`
2025-03-15 23:38:46 +08:00
Yan Yanchii
55815a6474
gh-130480: Move duplicate LOAD_SMALL_INT optimization from codegen to CFG (#130481) 2025-03-14 21:23:27 +00:00
Victor Stinner
a5776639c8
gh-111178: Fix function signatures to fix undefined behavior (#131191) 2025-03-14 09:52:15 +00:00
Victor Stinner
0ddfb5717f
gh-111178: Fix _PyLegacyEventHandler_Type deallocator (#131193)
Don't use PyObject_Free() as tp_dealloc to avoid an undefined
behavior. Instead, use the default deallocator which just calls
tp_free which is PyObject_Free().
2025-03-14 10:23:54 +01:00
Hood Chatham
f3e275f1a9
GH-130396: Work around for broken pthread_get_stackaddr_np on Emscripten (#131088)
Implements a workaround implementation of `pthread_get_stackaddr_np` for Emscripten.
This will be replaced by an implementation that will be included in Emscripten 4.0.6.
2025-03-14 07:04:40 +08:00
Tomasz Pytel
c5abded099
gh-130382: add missing _PyReftracerTrack to ceval Py_DECREF (#130689) 2025-03-13 12:31:49 -04:00
Irit Katriel
4242c2b8d0
gh-130080: move _Py_EnsureArrayLargeEnough to a separate header so it can be used outside of the compiler (#130930) 2025-03-13 16:02:58 +00:00
Victor Stinner
9a63138e09
gh-111178: Fix function signatures in misc files (#131180) 2025-03-13 16:55:08 +01:00
Russell Keith-Magee
dd6d24e9d2
gh-130940: Modify default behavior of PyConfig.use_system_logger to enable on iOS (#131172)
Modify default behavior of use_system_log to enable on iOS.
2025-03-13 14:28:49 +08:00
Yan Yanchii
3618240624
gh-126835: Avoid creating unnecessary tuple when looking for constant sequence during constant folding (#131054) 2025-03-12 21:45:54 +00:00
Kumar Aditya
ea57ffa02e
gh-131141: fix data race in instrumentation while registering callback (#131142) 2025-03-13 00:11:52 +05:30
T. Wouters
de2f7da77d
gh-115999: Add free-threaded specialization for FOR_ITER (#128798)
Add free-threaded versions of existing specialization for FOR_ITER (list, tuples, fast range iterators and generators), without significantly affecting their thread-safety. (Iterating over shared lists/tuples/ranges should be fine like before. Reusing iterators between threads is not fine, like before. Sharing generators between threads is a recipe for significant crashes, like before.)
2025-03-12 16:21:46 +01:00
Stan Ulbrych
155c44b901
gh-81267: Correct time.sleep() error message (#131055) 2025-03-12 08:12:57 +00:00
Tian Gao
8b1edae93a
gh-122029: Do not unpack method for legacy tracing anymore (#130898) 2025-03-11 14:04:22 -04:00
Victor Stinner
9d759b63d8
gh-111178: Change Argument Clinic signature for METH_O (#130682)
Use "PyObject*" for METH_O functions to fix an undefined behavior.
2025-03-11 16:33:36 +01:00