summaryrefslogtreecommitdiffstats
path: root/Python/traceback.c
Commit message (Collapse)AuthorAgeFilesLines
* gh-142737: Handle lost `io.open` in `_Py_FindSourceFile` (GH-142747)Bartosz Sławecki2025-12-151-0/+3
|
* gh-138122: Don't sample partial frame chains (#141912)Pablo Galindo Salgado2025-12-071-1/+1
|
* gh-116008: Detect freed thread state in faulthandler (#141988)Victor Stinner2025-11-271-4/+19
| | | Add _PyMem_IsULongFreed() function.
* gh-140815: Fix faulthandler for invalid/freed frame (#140921)Victor Stinner2025-11-041-23/+37
| | | | | | | | | | | | | 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.
* gh-125434: Fix non-ASCII thread names in faulthandler on Windows (#140700)Victor Stinner2025-10-281-12/+53
| | | | | | | 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().
* gh-125434: Display thread name in faulthandler on Windows (#140675)Victor Stinner2025-10-271-14/+75
|
* gh-138661: fix data race in `PyCode_Addr2Line` (#138664)Kumar Aditya2025-09-121-2/+2
|
* gh-137185: Fix `_Py_DumpStack()` async signal safety (gh-137187)Sam Gross2025-07-291-0/+10
| | | | | | | | 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.
* gh-108512: Add and use new replacements for PySys_GetObject() (GH-111035)Serhiy Storchaka2025-05-281-3/+2
| | | | | Add functions PySys_GetAttr(), PySys_GetAttrString(), PySys_GetOptionalAttr() and PySys_GetOptionalAttrString().
* GH-124715: Move trashcan mechanism into `Py_Dealloc` (GH-132280)Mark Shannon2025-04-301-2/+0
|
* gh-127604: ensure `-ldl` is passed only once to the linker (#133071)Bénédikt Tran2025-04-281-2/+2
|
* gh-127604: Only define dump_pointer() if CAN_C_BACKTRACE (#132897)Victor Stinner2025-04-251-0/+2
|
* gh-127604: Replace dprintf() with _Py_write_noraise() (#132854)Victor Stinner2025-04-231-16/+52
|
* gh-127604: Allow faulthandler to dumpC stack on MacOS (#132841)Pablo Galindo Salgado2025-04-231-3/+20
|
* gh-127604: Add C stack dumps to `faulthandler` (#128159)Peter Bierma2025-04-211-0/+108
|
* gh-125434: Fix building on OpenBSD (GH-132393)Serhiy Storchaka2025-04-121-0/+11
| | | pthread_get_name_np is defined in pthread_np.h.
* gh-125434: Display thread name in faulthandler (#132016)Victor Stinner2025-04-041-1/+22
|
* gh-131238: Remove includes from pycore_interp.h (#131495)Victor Stinner2025-03-201-5/+2
| | | Remove also now unused includes in C files.
* gh-128421: add critical section around `traceback.tb_next` (#131322)Kumar Aditya2025-03-201-13/+30
|
* gh-130163: Fix crashes related to PySys_GetObject() (GH-130503)Serhiy Storchaka2025-02-251-5/+14
| | | | | | | | 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().
* gh-111178: fix UBSan failures in `Python/traceback.c` (GH-128259)Bénédikt Tran2025-01-271-16/+26
|
* GH-128563: Add new frame owner type for interpreter entry frames (GH-129078)Mark Shannon2025-01-211-3/+3
| | | Add new frame owner type for interpreter entry frames
* gh-123967: Fix faulthandler for trampoline frames (#127329)Victor Stinner2024-11-271-9/+14
| | | If the top-most frame is a trampoline frame, skip it.
* gh-117764: Fix and add signatures for many builtins (GH-117769)Serhiy Storchaka2024-04-121-4/+4
|
* gh-117411: move PyFutureFeatures to pycore_symtable.h and make it private ↵Irit Katriel2024-04-021-1/+0
| | | | (#117412)
* GH-113655: Lower the C recursion limit on various platforms (GH-113944)Mark Shannon2024-01-161-1/+5
|
* Remove dead code left after gh-110721 (#111905)Serhiy Storchaka2023-11-101-37/+0
|
* Remove unnecessary includes (GH-111633)Serhiy Storchaka2023-11-021-1/+0
|
* gh-109181: Speed up Traceback object creation by lazily compute the line ↵Pablo Galindo Salgado2023-10-311-6/+29
| | | | | number (#111548) Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
* gh-110721: Use the traceback module for PyErr_Display() and fallback to the ↵Pablo Galindo Salgado2023-10-121-296/+19
| | | | C implementation (#110702)
* gh-104169: Fix test_peg_generator after tokenizer refactoring (#110727)Lysandros Nikolaou2023-10-121-1/+1
| | | | * Fix test_peg_generator after tokenizer refactoring * Remove references to tokenizer.c in comments etc.
* gh-110014: Include explicitly <unistd.h> header (#110155)Victor Stinner2023-09-301-3/+4
| | | | | | | | | | | * 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.
* gh-110052: Fix faulthandler for freed tstate (#110069)Victor Stinner2023-09-291-10/+37
| | | | faulthandler now detected freed interp and freed tstate, and no longer dereference them.
* gh-106922: Fix error location for constructs with spaces and parentheses ↵Pablo Galindo Salgado2023-09-081-0/+17
| | | | (#108959)
* gh-108765: Cleanup #include in Python/*.c files (#108977)Victor Stinner2023-09-061-2/+2
| | | Mention one symbol imported by each #include.
* gh-106320: Remove private _PySys functions (#108452)Victor Stinner2023-08-241-0/+1
| | | | | | | | | | 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.
* Ignore _Py_write_noraise() result: cast to (void) (#108291)Victor Stinner2023-08-221-5/+5
| | | | Code using _Py_write_noraise() usually cannot report. Ignore errors is the least surprising behavior for users.
* GH-108035: Remove the `_PyCFrame` struct as it is no longer needed for ↵Mark Shannon2023-08-171-1/+1
| | | | performance. (GH-108036)
* gh-106869: Use new PyMemberDef constant names (#106871)Victor Stinner2023-07-251-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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)
* GH-100987: Allow objects other than code objects as the "executable" of an ↵Mark Shannon2023-06-141-2/+2
| | | | | | | | | | 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.
* gh-105148: make _PyASTOptimizeState internal to ast_opt.c (#105149)Irit Katriel2023-05-311-5/+1
|
* GH-96803: Add three C-API functions to make _PyInterpreterFrame less opaque ↵Mark Shannon2023-05-051-1/+1
| | | | for users of PEP 523. (GH-96849)
* gh-102192: Replace PyErr_Fetch/Restore etc by more efficient alternatives ↵Irit Katriel2023-03-161-9/+10
| | | | (#102760)
* GH-101578: Normalize the current exception (GH-101607)Mark Shannon2023-02-081-4/+5
| | | | | | | | | | * Make sure that the current exception is always normalized. * Remove redundant type and traceback fields for the current exception. * Add new API functions: PyErr_GetRaisedException, PyErr_SetRaisedException * Add new API functions: PyException_GetArgs, PyException_SetArgs
* gh-99537: Use Py_SETREF() function in C code (#99657)Victor Stinner2022-11-221-5/+2
| | | | | | | | | | | | | | | Fix potential race condition in code patterns: * Replace "Py_DECREF(var); var = new;" with "Py_SETREF(var, new);" * Replace "Py_XDECREF(var); var = new;" with "Py_XSETREF(var, new);" * Replace "Py_CLEAR(var); var = new;" with "Py_XSETREF(var, new);" Other changes: * Replace "old = var; var = new; Py_DECREF(var)" with "Py_SETREF(var, new);" * Replace "old = var; var = new; Py_XDECREF(var)" with "Py_XSETREF(var, new);" * And remove the "old" variable.
* gh-99103: Normalize specialized traceback anchors against the current line ↵Batuhan Taskaya2022-11-121-2/+7
| | | | | (GH-99145) Automerge-Triggered-By: GH:isidentical
* GH-96421: Insert shim frame on entry to interpreter (GH-96319)Mark Shannon2022-11-101-0/+9
| | | | | | * Adds EXIT_INTERPRETER instruction to exit PyEval_EvalDefault() * Simplifies RETURN_VALUE, YIELD_VALUE and RETURN_GENERATOR instructions as they no longer need to check for entry frames.
* gh-99300: Use Py_NewRef() in Python/ directory (#99317)Victor Stinner2022-11-101-10/+5
| | | | | | Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and Py_XNewRef() in C files of the Python/ directory. Update Parser/asdl_c.py to regenerate Python/Python-ast.c.
* gh-93883: elide traceback indicators when possible (#93994)John Belmonte2022-07-111-4/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * gh-93883: elide traceback indicators when possible Elide traceback column indicators when the entire line of the frame is implicated. This reduces traceback length and draws even more attention to the remaining (very relevant) indicators. Example: ``` Traceback (most recent call last): File "query.py", line 99, in <module> bar() File "query.py", line 66, in bar foo() File "query.py", line 37, in foo magic_arithmetic('foo') File "query.py", line 18, in magic_arithmetic return add_counts(x) / 25 ^^^^^^^^^^^^^ File "query.py", line 24, in add_counts return 25 + query_user(user1) + query_user(user2) ^^^^^^^^^^^^^^^^^ File "query.py", line 32, in query_user return 1 + query_count(db, response['a']['b']['c']['user'], retry=True) ~~~~~~~~~~~~~~~~~~^^^^^ TypeError: 'NoneType' object is not subscriptable ``` Rather than going out of our way to provide indicator coverage in every traceback test suite, the indicator test suite should be responible for sufficient coverage (e.g. by adding a basic exception group test to ensure that margin strings are covered).
* gh-93937, C API: Move PyFrame_GetBack() to Python.h (#93938)Victor Stinner2022-06-191-1/+2
| | | | | | | | | | | | | | | | Move the follow functions and type from frameobject.h to pyframe.h, so the standard <Python.h> provide frame getter functions: * PyFrame_Check() * PyFrame_GetBack() * PyFrame_GetBuiltins() * PyFrame_GetGenerator() * PyFrame_GetGlobals() * PyFrame_GetLasti() * PyFrame_GetLocals() * PyFrame_Type Remove #include "frameobject.h" from many C files. It's no longer needed.