summaryrefslogtreecommitdiff
path: root/Python/traceback.c
AgeCommit message (Collapse)AuthorLines
2021-05-03bpo-42800: Add audit events for f_code and tb_frame (GH-24182)Miss Islington (bot)-1/+1
Accessing the following attributes will now fire PEP 578 style audit hooks as (object.__getattr__, obj, name): * PyTracebackObject: tb_frame * PyFrameObject: f_code * PyGenObject: gi_code, gi_frame * PyCoroObject: cr_code, cr_frame * PyAsyncGenObject: ag_code, ag_frame (cherry picked from commit bb2f3ff7a8f0c3565ccc1946dba7e09a3f7dc209) Co-authored-by: Steve Dower <steve.dower@python.org>
2020-12-17bpo-26564: fix obsolete comment in traceback.c (GH-23819)Miss Islington (bot)-1/+2
(cherry picked from commit 40125ab3252453bf205ed906e46bf9741c27bf9d) Co-authored-by: Irit Katriel <iritkatriel@yahoo.com>
2019-09-18[3.8] bpo-38070: Py_FatalError() logs runtime state (GH-16258)Victor Stinner-5/+8
* bpo-38070: _Py_DumpTraceback() writes <no Python frame> (GH-16244) When a Python thread has no frame, _Py_DumpTraceback() and _Py_DumpTracebackThreads() now write "<no Python frame>", rather than writing nothing. (cherry picked from commit 8fa3e1740b3f03ea65ddb68411c2238c5f98eec2) * bpo-38070: Enhance _PyObject_Dump() (GH-16243) _PyObject_Dump() now dumps the object address for freed objects and objects with ob_type=NULL. (cherry picked from commit b39afb78768418d9405c4b528c80fa968ccc974d) * bpo-38070: Add _PyRuntimeState.preinitializing (GH-16245) Add _PyRuntimeState.preinitializing field: set to 1 while Py_PreInitialize() is running. _PyRuntimeState: rename also pre_initialized field to preinitialized. (cherry picked from commit d3b904144e86e2442961de6a7dccecbe133d5c6d) * bpo-38070: Py_FatalError() logs runtime state (GH-16246) (cherry picked from commit 1ce16fb0977283ae42a9f8917bbca5f44aa69324)
2019-05-30bpo-36974: tp_print -> tp_vectorcall_offset and tp_reserved -> tp_as_async ↵Jeroen Demeyer-2/+2
(GH-13464) Automatically replace tp_print -> tp_vectorcall_offset tp_compare -> tp_as_async tp_reserved -> tp_as_async
2019-05-23bpo-36829: PyErr_WriteUnraisable() normalizes exception (GH-13507)Victor Stinner-2/+13
PyErr_WriteUnraisable() now creates a traceback object if there is no current traceback. Moreover, call PyErr_NormalizeException() and PyException_SetTraceback() to normalize the exception value. Ignore silently any error.
2019-05-10bpo-35983: skip trashcan for subclasses (GH-11841)Jeroen Demeyer-2/+2
Add new trashcan macros to deal with a double deallocation that could occur when the `tp_dealloc` of a subclass calls the `tp_dealloc` of a base class and that base class uses the trashcan mechanism. Patch by Jeroen Demeyer.
2018-11-27bpo-33029: Fix signatures of getter and setter functions. (GH-10746)Serhiy Storchaka-1/+2
Fix also return type for few other functions (clear, releasebuffer).
2018-11-12bpo-35081: Rename internal headers (GH-10275)Victor Stinner-1/+1
Rename Include/internal/ headers: * pycore_hash.h -> pycore_pyhash.h * pycore_lifecycle.h -> pycore_pylifecycle.h * pycore_mem.h -> pycore_pymem.h * pycore_state.h -> pycore_pystate.h Add missing headers to Makefile.pre.in and PCbuild: * pycore_condvar.h. * pycore_hamt.h * pycore_pyhash.h
2018-11-01bpo-35081: Add pycore_ prefix to internal header files (GH-10263)Victor Stinner-1/+1
* Rename Include/internal/ header files: * pyatomic.h -> pycore_atomic.h * ceval.h -> pycore_ceval.h * condvar.h -> pycore_condvar.h * context.h -> pycore_context.h * pygetopt.h -> pycore_getopt.h * gil.h -> pycore_gil.h * hamt.h -> pycore_hamt.h * hash.h -> pycore_hash.h * mem.h -> pycore_mem.h * pystate.h -> pycore_state.h * warnings.h -> pycore_warnings.h * PCbuild project, Makefile.pre.in, Modules/Setup: add the Include/internal/ directory to the search paths of header files. * Update includes. For example, replace #include "internal/mem.h" with #include "pycore_mem.h".
2018-09-10bpo-34588: Fix an off-by-one error in traceback formatting. (GH-9077)Benjamin Peterson-14/+16
The recursive frame pruning code always undercounted the number of elided frames by one. That is, in the "[Previous line repeated N more times]" message, N would always be one too few. Near the recursive pruning cutoff, one frame could be silently dropped. That situation is demonstrated in the OP of the bug report. The fix is to start the identical frame counter at 1.
2018-04-29bpo-33012: Fix invalid function cast warnings with gcc 8 for METH_NOARGS. ↵Siddhesh Poyarekar-1/+1
(GH-6030) METH_NOARGS functions need only a single argument but they are cast into a PyCFunction, which takes two arguments. This triggers an invalid function cast warning in gcc8 due to the argument mismatch. Fix this by adding a dummy unused argument.
2018-01-07bpo-30579: Allow TracebackType creation and tb_next mutation from Python ↵Nathaniel J. Smith-26/+123
(GH-4793) Third party projects may wish to hide their own internal machinery in order to present more comprehensible tracebacks to end users (e.g. Jinja2 and Trio both do this). Previously such projects have had to rely on ctypes to do so: https://github.com/pallets/jinja/blob/fe3dadacdf4cf411d0a5b6bbd4d5234697a28af2/jinja2/debug.py#L345 https://github.com/python-trio/trio/blob/1e86b1aee8c0c759f6f239ae53a05d0d3963c629/trio/_core/_multierror.py#L296 This provides a Python level API for creating and modifying real Traceback objects, allowing tracebacks to be edited at runtime. Patch by Nathaniel Smith.
2017-11-15bpo-31949: Fixed several issues in printing tracebacks ↵Serhiy Storchaka-51/+51
(PyTraceBack_Print()). (#4289) * Setting sys.tracebacklimit to 0 or less now suppresses printing tracebacks. * Setting sys.tracebacklimit to None now causes using the default limit. * Setting sys.tracebacklimit to an integer larger than LONG_MAX now means using the limit LONG_MAX rather than the default limit. * Fixed integer overflows in the case of more than 2**31 traceback items on Windows. * Fixed output errors handling.
2017-10-06bpo-25658: Implement PEP 539 for Thread Specific Storage (TSS) API (GH-1362)Masayuki Yamamoto-1/+1
See PEP 539 for details. Highlights of changes: - Add Thread Specific Storage (TSS) API - Document the Thread Local Storage (TLS) API as deprecated - Update code that used TLS API to use TSS API
2017-09-07bpo-30860: Consolidate stateful runtime globals. (#3397)Eric Snow-0/+1
* group the (stateful) runtime globals into various topical structs * consolidate the topical structs under a single top-level _PyRuntimeState struct * add a check-c-globals.py script that helps identify runtime globals Other globals are excluded (see globals.txt and check-c-globals.py).
2017-09-07bpo-31370: Remove support for threads-less builds (#3385)Antoine Pitrou-16/+0
* Remove Setup.config * Always define WITH_THREAD for compatibility.
2017-03-23bpo-6532: Make the thread id an unsigned integer. (#781)Serhiy Storchaka-1/+1
* bpo-6532: Make the thread id an unsigned integer. From C API side the type of results of PyThread_start_new_thread() and PyThread_get_thread_ident(), the id parameter of PyThreadState_SetAsyncExc(), and the thread_id field of PyThreadState changed from "long" to "unsigned long". * Restore a check in thread_get_ident().
2016-10-18Issue #23782: Fixed possible memory leak in _PyTraceback_Add() and exceptionSerhiy Storchaka-20/+26
loss in PyTraceBack_Here().
2016-10-18Issue #23782: Fixed possible memory leak in _PyTraceback_Add() and exceptionSerhiy Storchaka-20/+26
loss in PyTraceBack_Here().
2016-09-05Avoid calling functions with an empty string as format stringVictor Stinner-2/+2
Directly pass NULL rather than an empty string.
2016-08-20Fix reference leak in tb_printinternal()Victor Stinner-0/+2
Issue #26823.
2016-08-15Issue #26823: Abbreviate recursive tracebacksNick Coghlan-4/+32
Large sections of repeated lines in tracebacks are now abbreviated as "[Previous line repeated {count} more times]" by both the traceback module and the builtin traceback rendering. Patch by Emanuel Barry.
2016-06-17Issue #27336: Fix compilation failures --without-threadsBerker Peksag-1/+1
2016-03-23Rework _Py_DumpASCII() to make Coverity happyVictor Stinner-8/+8
2016-03-23Issue #23848: Expose _Py_DumpHexadecimal()Victor Stinner-8/+9
This function will be reused by faulthandler.
2016-03-16faulthandler now works in non-Python threadsVictor Stinner-2/+47
Issue #26563: * Add _PyGILState_GetInterpreterStateUnsafe() function: the single PyInterpreterState used by this process' GILState implementation. * Enhance _Py_DumpTracebackThreads() to retrieve the interpreter state from autoInterpreterState in last resort. The function now accepts NULL for interp and current_tstate parameters. * test_faulthandler: fix a ResourceWarning when test is interrupted by CTRL+c
2016-03-16Fix compilation error of traceback.c on WindowsVictor Stinner-3/+3
Issue #26564.
2016-03-15Enhance and rewrite traceback dump C functionsVictor Stinner-52/+55
Issue #26564: * Expose _Py_DumpASCII() and _Py_DumpDecimal() in traceback.h * Change the type of the second _Py_DumpASCII() parameter from int to unsigned long * Rewrite _Py_DumpDecimal() and dump_hexadecimal() to write directly characters in the expected order, avoid the need of reversing the string. * dump_hexadecimal() limits width to the size of the buffer * _Py_DumpASCII() does nothing if the object is not a Unicode string * dump_frame() wrtites "???" as the line number if the line number is negative
2015-06-21Issue #24436: Added const qualifiers for char* arguments of _PyTraceback_Add.Serhiy Storchaka-1/+1
Patch by Michael Ensslin.
2015-06-21Issue #24436: Added const qualifiers for char* arguments of _PyTraceback_Add.Serhiy Storchaka-1/+1
Patch by Michael Ensslin.
2015-04-12Issue #23524: Replace _PyVerify_fd function with calls to ↵Steve Dower-0/+2
_set_thread_local_invalid_parameter_handler.
2015-04-01Issue #23836: Use _Py_write_noraise() to retry on EINTR in _Py_DumpTraceback()Victor Stinner-8/+20
and _Py_DumpTracebackThreads(). Document also these functions to explain that the caller is responsible to call PyErr_CheckSignals().
2015-03-25Merge 3.4 (traceback)Victor Stinner-1/+8
2015-03-25Issue #23571: If io.TextIOWrapper constructor fails in _Py_DisplaySourceLine(),Victor Stinner-1/+8
close the binary file to fix a resource warning.
2014-10-30(Merge 3.4) Issue #22762: Fix _Py_DisplaySourceLine(), clear the exception ifVictor Stinner-0/+1
PyFile_GetLine() failed. Patch written by Xavier de Gaye.
2014-10-30Issue #22762: Fix _Py_DisplaySourceLine(), clear the exception ifVictor Stinner-0/+1
PyFile_GetLine() failed. Patch written by Xavier de Gaye.
2014-10-08Issue #22462: Fix pyexpat's creation of a dummy frame to make it appear in ↵Antoine Pitrou-0/+33
exception tracebacks. Initial patch by Mark Shannon.
2014-10-08Issue #22462: Fix pyexpat's creation of a dummy frame to make it appear in ↵Antoine Pitrou-0/+33
exception tracebacks. Initial patch by Mark Shannon.
2014-10-03faulthandler: enhance dump_ascii() to escape also non-printable ASCIIVictor Stinner-4/+5
characters (U+0000..U+001f and U+007f).
2014-08-15Issue #22156: Fix "comparison between signed and unsigned integers" compilerVictor Stinner-1/+1
warnings in the Python/ subdirectory.
2013-12-19Fix _Py_DisplaySourceLine(), if PyTokenizer_FindEncodingFilename() fails, clearVictor Stinner-0/+2
the exception to not call open() with an exception set.
2013-11-07Issue #19512, #19515: remove shared identifiers, move identifiers where theyVictor Stinner-5/+6
are used. Move also _Py_IDENTIFIER() defintions to the top in modified files to remove identifiers duplicated in the same file.
2013-11-06Issue #19512: add some common identifiers to only create common strings once,Victor Stinner-1/+1
instead of creating temporary Unicode string objects Add also more identifiers in pythonrun.c to avoid temporary Unicode string objets for the interactive interpreter.
2013-10-20Issue 19306: Add extra hints to faulthandler stack dumps that they are ↵Guido van Rossum-8/+8
upside down.
2013-07-21merge 3.3Benjamin Peterson-1/+1
2013-07-21fix spacingBenjamin Peterson-1/+1
2013-07-21merge 3.3Benjamin Peterson-2/+2
2013-07-21let's not return NULL from functions that should return intsBenjamin Peterson-2/+2
2013-07-21Check return value of lseek() in _Py_DisplaySourceLine().Christian Heimes-1/+7
Also use portable SEEK_SET instead of 0. CID 1040639
2013-07-21Check return value of lseek() in _Py_DisplaySourceLine().Christian Heimes-1/+7
Also use portable SEEK_SET instead of 0. CID 1040639