Serhiy Storchaka
fbbe36329b
[3.15] gh-113318: Fix @getter and @setter in Argument Clinic (GH-155778) (GH-156010)
...
(cherry picked from commit 915970ce9d )
2026-10-09 20:54:35 +03:00
Miss Islington (bot) and Carlo Bramini
fe23abac94
[3.15] gh-152903: Change PCWSTR to PWSTR in GetThreadDescription() typedef (GH-152904) ( #152943 )
...
gh-152903: Change PCWSTR to PWSTR in GetThreadDescription() typedef (GH-152904)
Fixes issue GH-152903
(cherry picked from commit ac1acb6d7d )
Co-authored-by: Carlo Bramini <carlo_bramini@users.sourceforge.net >
2026-07-03 11:33:14 +00:00
646853df13
gh-145559: Add PyUnstable_DumpTraceback() and PyUnstable_DumpTracebackThreads() ( #148145 )
...
Co-authored-by: Petr Viktorin <encukou@gmail.com >
Co-authored-by: Victor Stinner <vstinner@python.org >
2026-05-06 15:01:12 +00:00
Eric Froemling
7686abe063
gh-149085: Add max_threads keyword to faulthandler.dump_traceback() (GH-149106)
...
Add a keyword-only `max_threads` argument to `dump_traceback()` and
`dump_traceback_later()`, defaulting to 100 to preserve existing
behavior. Allows server processes with many worker threads to dump
beyond the historical 100-thread cap (previously a hardcoded
`MAX_NTHREADS = 100` in `Python/traceback.c`).
The cap matters in practice: tstates are prepended to the
PyInterpreterState linked list, so the dump walks newest-first. With
more than 100 threads alive, the main thread (oldest, at the tail) is
silently elided from watchdog dumps -- exactly the thread that's
usually wanted.
The hardcoded value is moved to a new internal macro
`_Py_TRACEBACK_MAX_NTHREADS` in `pycore_traceback.h` so the in-tree
fatal-signal callers all reference one source of truth.
2026-04-30 09:27:57 -04:00
VanshAgarwal24036
59d97683c1
gh-145792: Fix incorrect alloca allocation size in traceback.c ( #145814 )
2026-03-13 13:15:26 +01:00
Sam Gross
7a572d9f21
gh-143108: Don't instrument some faulthandler related functions for TSan ( #143450 )
2026-01-05 22:13:29 +01:00
Sam Gross
50ecd6b880
gh-143108: Don't instrument faulthandler.c for TSan ( #143109 )
...
The dumping of tracebacks has data races and that's okay (it's best
effort).
2025-12-24 02:12:55 +01:00
Bartosz Sławecki
f277781bba
gh-142737: Handle lost io.open in _Py_FindSourceFile (GH-142747)
2025-12-15 22:58:50 +00:00
Pablo Galindo Salgado
d6d850df89
gh-138122: Don't sample partial frame chains ( #141912 )
2025-12-07 15:53:48 +00:00
Victor Stinner
d5d9e89dde
gh-116008: Detect freed thread state in faulthandler ( #141988 )
...
Add _PyMem_IsULongFreed() function.
2025-11-27 12:35:00 +01:00
Victor Stinner
a84181c31b
gh-140815: Fix faulthandler for invalid/freed frame ( #140921 )
...
faulthandler now detects if a frame or a code object is invalid or
freed.
Add helper functions:
* _PyCode_SafeAddr2Line()
* _PyFrame_SafeGetCode()
* _PyFrame_SafeGetLasti()
_PyMem_IsPtrFreed() now detects pointers in [-0xff, 0xff] range
as freed.
2025-11-04 11:48:28 +01:00
Victor Stinner
80f20f58b2
gh-125434: Fix non-ASCII thread names in faulthandler on Windows ( #140700 )
...
Add _Py_DumpWideString() function to dump a wide string as ASCII. It
supports surrogate pairs.
Replace _Py_EncodeLocaleRaw() with _Py_DumpWideString()
in write_thread_name().
2025-10-28 14:41:51 +01:00
Victor Stinner
313145eab5
gh-125434: Display thread name in faulthandler on Windows ( #140675 )
2025-10-27 18:41:18 +01:00
Kumar Aditya
ea26f6da39
gh-138661: fix data race in PyCode_Addr2Line ( #138664 )
2025-09-12 18:04:55 +05:30
Sam Gross
11a8652e25
gh-137185: Fix _Py_DumpStack() async signal safety (gh-137187)
...
Call backtrace() once when installing the signal handler to ensure that
libgcc is dynamically loaded outside the signal handler.
This fixes a "signal-unsafe call inside of a signal" TSan error from
test_faulthandler.test_enable_fd.
2025-07-29 14:25:32 +00:00
Serhiy Storchaka
bac3fcba5b
gh-108512: Add and use new replacements for PySys_GetObject() (GH-111035)
...
Add functions PySys_GetAttr(), PySys_GetAttrString(),
PySys_GetOptionalAttr() and PySys_GetOptionalAttrString().
2025-05-28 20:11:09 +03:00
Mark Shannon
44e4c479fb
GH-124715: Move trashcan mechanism into Py_Dealloc (GH-132280)
2025-04-30 11:37:53 +01:00
Bénédikt Tran
af3f6fcb7e
gh-127604: ensure -ldl is passed only once to the linker ( #133071 )
2025-04-28 11:55:02 +02:00
Victor Stinner
c292f7f563
gh-127604: Only define dump_pointer() if CAN_C_BACKTRACE ( #132897 )
2025-04-25 09:28:34 +02:00
Victor Stinner
402dba2928
gh-127604: Replace dprintf() with _Py_write_noraise() ( #132854 )
2025-04-23 20:02:25 +00:00
Pablo Galindo Salgado
1007aab133
gh-127604: Allow faulthandler to dumpC stack on MacOS ( #132841 )
2025-04-23 18:23:24 +01:00
Peter Bierma
8dfa840773
gh-127604: Add C stack dumps to faulthandler ( #128159 )
2025-04-21 20:48:02 +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
Victor Stinner
37d47d4965
gh-125434: Display thread name in faulthandler ( #132016 )
2025-04-04 12:24:41 +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
Kumar Aditya
39b37b0110
gh-128421: add critical section around traceback.tb_next ( #131322 )
2025-03-20 12:03:54 +05:30
Serhiy Storchaka
0ef4ffeefd
gh-130163: Fix crashes related to PySys_GetObject() (GH-130503)
...
The use of PySys_GetObject() and _PySys_GetAttr(), which return a borrowed
reference, has been replaced by using one of the following functions, which
return a strong reference and distinguish a missing attribute from an error:
_PySys_GetOptionalAttr(), _PySys_GetOptionalAttrString(),
_PySys_GetRequiredAttr(), and _PySys_GetRequiredAttrString().
2025-02-25 23:04:27 +02:00
Bénédikt Tran
ced296d2c0
gh-111178: fix UBSan failures in Python/traceback.c (GH-128259)
2025-01-27 15:07:39 +01:00
Mark Shannon
f5b6356a11
GH-128563: Add new frame owner type for interpreter entry frames (GH-129078)
...
Add new frame owner type for interpreter entry frames
2025-01-21 10:15:02 +00:00
Victor Stinner
58e334e143
gh-123967: Fix faulthandler for trampoline frames ( #127329 )
...
If the top-most frame is a trampoline frame, skip it.
2024-11-27 16:14:49 +01:00
Serhiy Storchaka
3a8c1ca7e7
gh-117764: Fix and add signatures for many builtins (GH-117769)
2024-04-12 13:56:41 +03:00
Irit Katriel
1d5479b236
gh-117411: move PyFutureFeatures to pycore_symtable.h and make it private ( #117412 )
2024-04-02 10:34:49 +00:00
Mark Shannon
17b73ab99e
GH-113655: Lower the C recursion limit on various platforms (GH-113944)
2024-01-16 09:32:01 +00:00
Serhiy Storchaka
06c47a305d
Remove dead code left after gh-110721 ( #111905 )
2023-11-10 22:30:01 +00:00
Serhiy Storchaka
a12f624a9d
Remove unnecessary includes (GH-111633)
2023-11-02 10:42:58 +02:00
Pablo Galindo Salgado
abb15420c1
gh-109181: Speed up Traceback object creation by lazily compute the line number ( #111548 )
...
Signed-off-by: Pablo Galindo <pablogsal@gmail.com >
2023-10-31 15:02:31 +00:00
Pablo Galindo Salgado
e7331365b4
gh-110721: Use the traceback module for PyErr_Display() and fallback to the C implementation ( #110702 )
2023-10-12 14:52:14 +00:00
Lysandros Nikolaou
17d65547df
gh-104169: Fix test_peg_generator after tokenizer refactoring ( #110727 )
...
* Fix test_peg_generator after tokenizer refactoring
* Remove references to tokenizer.c in comments etc.
2023-10-12 09:34:35 +02:00
Victor Stinner
7513994c92
gh-110014: Include explicitly <unistd.h> header ( #110155 )
...
* Remove unused <locale.h> includes.
* Remove unused <fcntl.h> include in traceback.h.
* Remove redundant <assert.h> and <stddef.h> includes. They are already
included by "Python.h".
* Remove <object.h> include in faulthandler.c. Python.h already includes it.
* Add missing <stdbool.h> in pycore_pythread.h if HAVE_PTHREAD_STUBS
is defined.
* Fix also warnings in pthread_stubs.h: don't redefine macros if they
are already defined, like the __NEED_pthread_t macro.
2023-09-30 20:06:45 +00:00
Victor Stinner
2e37a38bcb
gh-110052: Fix faulthandler for freed tstate ( #110069 )
...
faulthandler now detected freed interp and freed tstate, and no
longer dereference them.
2023-09-29 02:04:06 +00:00
Pablo Galindo Salgado
6275c67ea6
gh-106922: Fix error location for constructs with spaces and parentheses ( #108959 )
2023-09-08 17:18:35 +01:00
Victor Stinner
b298b395e8
gh-108765: Cleanup #include in Python/*.c files ( #108977 )
...
Mention one symbol imported by each #include.
2023-09-06 15:56:08 +02:00
Victor Stinner
a071ecb4d1
gh-106320: Remove private _PySys functions ( #108452 )
...
Move private functions to the internal C API (pycore_sysmodule.h):
* _PySys_GetAttr()
* _PySys_GetSizeOf()
No longer export most of these functions.
Fix also a typo in Include/cpython/optimizer.h: add a missing space.
2023-08-24 20:02:09 +00:00
Victor Stinner
6541fe4ad7
Ignore _Py_write_noraise() result: cast to (void) ( #108291 )
...
Code using _Py_write_noraise() usually cannot report. Ignore errors
is the least surprising behavior for users.
2023-08-22 14:28:20 +00:00
Mark Shannon
006e44f950
GH-108035: Remove the _PyCFrame struct as it is no longer needed for performance. (GH-108036)
2023-08-17 11:16:03 +01:00
Victor Stinner
1a3faba9f1
gh-106869: Use new PyMemberDef constant names ( #106871 )
...
* Remove '#include "structmember.h"'.
* If needed, add <stddef.h> to get offsetof() function.
* Update Parser/asdl_c.py to regenerate Python/Python-ast.c.
* Replace:
* T_SHORT => Py_T_SHORT
* T_INT => Py_T_INT
* T_LONG => Py_T_LONG
* T_FLOAT => Py_T_FLOAT
* T_DOUBLE => Py_T_DOUBLE
* T_STRING => Py_T_STRING
* T_OBJECT => _Py_T_OBJECT
* T_CHAR => Py_T_CHAR
* T_BYTE => Py_T_BYTE
* T_UBYTE => Py_T_UBYTE
* T_USHORT => Py_T_USHORT
* T_UINT => Py_T_UINT
* T_ULONG => Py_T_ULONG
* T_STRING_INPLACE => Py_T_STRING_INPLACE
* T_BOOL => Py_T_BOOL
* T_OBJECT_EX => Py_T_OBJECT_EX
* T_LONGLONG => Py_T_LONGLONG
* T_ULONGLONG => Py_T_ULONGLONG
* T_PYSSIZET => Py_T_PYSSIZET
* T_NONE => _Py_T_NONE
* READONLY => Py_READONLY
* PY_AUDIT_READ => Py_AUDIT_READ
* READ_RESTRICTED => Py_AUDIT_READ
* PY_WRITE_RESTRICTED => _Py_WRITE_RESTRICTED
* RESTRICTED => (READ_RESTRICTED | _Py_WRITE_RESTRICTED)
2023-07-25 15:28:30 +02:00
Mark Shannon
7199584ac8
GH-100987: Allow objects other than code objects as the "executable" of an internal frame. (GH-105727)
...
* Add table describing possible executable classes for out-of-process debuggers.
* Remove shim code object creation code as it is no longer needed.
* Make lltrace a bit more robust w.r.t. non-standard frames.
2023-06-14 13:46:37 +01:00
Irit Katriel
f990bb8b2d
gh-105148: make _PyASTOptimizeState internal to ast_opt.c ( #105149 )
2023-05-31 20:21:46 +01:00
Mark Shannon
a0df9ee8fc
GH-96803: Add three C-API functions to make _PyInterpreterFrame less opaque for users of PEP 523. (GH-96849)
2023-05-05 17:53:07 +01:00
Irit Katriel
6372e290c0
gh-102192: Replace PyErr_Fetch/Restore etc by more efficient alternatives ( #102760 )
2023-03-16 19:03:52 +00:00