Commit Graph

118 Commits

Author SHA1 Message Date
Victor Stinner 3466bde1cc Avoid calling functions with an empty string as format string
Directly pass NULL rather than an empty string.
2016-09-05 18:16:01 -07:00
Victor Stinner a88b2f4e5e Fix reference leak in tb_printinternal()
Issue #26823.
2016-08-20 03:05:13 +02:00
Nick Coghlan d00342347e Issue #26823: Abbreviate recursive tracebacks
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-08-15 13:11:34 +10:00
Berker Peksag 531396c764 Issue #27336: Fix compilation failures --without-threads 2016-06-17 13:25:01 +03:00
Victor Stinner 1c3069aed6 Rework _Py_DumpASCII() to make Coverity happy 2016-03-23 16:10:07 +01:00
Victor Stinner bd31b7c483 Issue #23848: Expose _Py_DumpHexadecimal()
This function will be reused by faulthandler.
2016-03-23 10:32:26 +01:00
Victor Stinner 861d9abfcf faulthandler now works in non-Python threads
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-16 22:45:24 +01:00
Victor Stinner 013024ef67 Fix compilation error of traceback.c on Windows
Issue #26564.
2016-03-16 09:43:14 +01:00
Victor Stinner 89e7cdcb9c Enhance and rewrite traceback dump C functions
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
2016-03-15 21:49:37 +01:00
Serhiy Storchaka ccfdf0923a Issue #24436: Added const qualifiers for char* arguments of _PyTraceback_Add.
Patch by Michael Ensslin.
2015-06-21 16:00:33 +03:00
Serhiy Storchaka 73c95f1949 Issue #24436: Added const qualifiers for char* arguments of _PyTraceback_Add.
Patch by Michael Ensslin.
2015-06-21 15:59:46 +03:00
Steve Dower 8fc8980c96 Issue #23524: Replace _PyVerify_fd function with calls to _set_thread_local_invalid_parameter_handler. 2015-04-12 00:26:27 -04:00
Victor Stinner 97f86b82b7 Issue #23836: Use _Py_write_noraise() to retry on EINTR in _Py_DumpTraceback()
and _Py_DumpTracebackThreads(). Document also these functions to explain that
the caller is responsible to call PyErr_CheckSignals().
2015-04-01 18:38:01 +02:00
Victor Stinner 39183dfc68 Merge 3.4 (traceback) 2015-03-25 02:30:01 +01:00
Victor Stinner 81f241ab2e Issue #23571: If io.TextIOWrapper constructor fails in _Py_DisplaySourceLine(),
close the binary file to fix a resource warning.
2015-03-25 02:25:25 +01:00
Victor Stinner 3188f828bb (Merge 3.4) Issue #22762: Fix _Py_DisplaySourceLine(), clear the exception if
PyFile_GetLine() failed. Patch written by Xavier de Gaye.
2014-10-30 10:17:59 +01:00
Victor Stinner 5e78f4daa8 Issue #22762: Fix _Py_DisplaySourceLine(), clear the exception if
PyFile_GetLine() failed. Patch written by Xavier de Gaye.
2014-10-30 10:17:27 +01:00
Antoine Pitrou 94262ebc9c Issue #22462: Fix pyexpat's creation of a dummy frame to make it appear in exception tracebacks.
Initial patch by Mark Shannon.
2014-10-08 20:02:40 +02:00
Antoine Pitrou 0ddbf4795f Issue #22462: Fix pyexpat's creation of a dummy frame to make it appear in exception tracebacks.
Initial patch by Mark Shannon.
2014-10-08 20:00:09 +02:00
Victor Stinner b86f08f743 faulthandler: enhance dump_ascii() to escape also non-printable ASCII
characters (U+0000..U+001f and U+007f).
2014-10-03 14:18:09 +02:00
Victor Stinner 98ea54c35c Issue #22156: Fix "comparison between signed and unsigned integers" compiler
warnings in the Python/ subdirectory.
2014-08-15 23:30:40 +02:00
Victor Stinner 5272fa9c57 Fix _Py_DisplaySourceLine(), if PyTokenizer_FindEncodingFilename() fails, clear
the exception to not call open() with an exception set.
2013-12-19 13:39:32 +01:00
Victor Stinner bd303c165b Issue #19512, #19515: remove shared identifiers, move identifiers where they
are used.

Move also _Py_IDENTIFIER() defintions to the top in modified files to remove
identifiers duplicated in the same file.
2013-11-07 23:07:29 +01:00
Victor Stinner 090543736f Issue #19512: add some common identifiers to only create common strings once,
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-11-06 22:41:44 +01:00
Guido van Rossum 7be5d7d0e0 Issue 19306: Add extra hints to faulthandler stack dumps that they are upside down. 2013-10-20 18:21:02 -07:00
Benjamin Peterson c3e10c237b merge 3.3 2013-07-21 13:29:42 -07:00
Benjamin Peterson 0f9b7d32c7 fix spacing 2013-07-21 13:29:37 -07:00
Benjamin Peterson 33113a3504 merge 3.3 2013-07-21 13:26:27 -07:00
Benjamin Peterson 04b01dc8f7 let's not return NULL from functions that should return ints 2013-07-21 13:26:13 -07:00
Christian Heimes 02e8b53e6d Check return value of lseek() in _Py_DisplaySourceLine().
Also use portable SEEK_SET instead of 0.
CID 1040639
2013-07-21 02:12:44 +02:00
Christian Heimes 1f34729f42 Check return value of lseek() in _Py_DisplaySourceLine().
Also use portable SEEK_SET instead of 0.
CID 1040639
2013-07-21 02:12:35 +02:00
Christian Heimes 8282d749a6 Check return value of PyObject_AsFileDescriptor() in _Py_DisplaySourceLine() for error
CID 486768
2013-07-21 01:53:18 +02:00
Christian Heimes 8c077bc03e Check return value of PyObject_AsFileDescriptor() in _Py_DisplaySourceLine() for error
CID 486768
2013-07-21 01:53:10 +02:00
Victor Stinner ceceaa00ba Issue #18408: Fix _Py_DisplaySourceLine()
Report _Py_FindSourceFile() error, so the error is cleared;
and clear io.open(filename) exception on failure.
2013-07-16 00:32:14 +02:00
Victor Stinner 84bb1cf994 Fix compilater warnings on Windows 64-bit 2013-05-17 00:12:04 +02:00
Victor Stinner 54f939b9ae Issue #15463: the faulthandler module truncates strings to 500 characters,
instead of 100, to be able to display long file paths
2012-07-30 13:08:58 +02:00
Kristján Valur Jónsson c5963d3842 Issue #15365: Make traceback reporting ignore any errors when printing out
the source line.  Such errors can't be reported anyway.  This makes error
reporting work, even if the "io" module can't be loaded.
2012-07-19 21:02:03 +00:00
Victor Stinner 63ab875cfe Remove "#ifdef Py_UNICODE_WIDE": Python is now always wide 2011-11-22 03:31:20 +01:00
Martin v. Löwis bd928fef42 Rename _Py_identifier to _Py_IDENTIFIER. 2011-10-14 10:20:37 +02:00
Victor Stinner f5cff56a1b Issue #13088: Add shared Py_hexdigits constant to format a number into base 16 2011-10-14 02:13:11 +02:00
Martin v. Löwis afe55bba33 Add API for static strings, primarily good for identifiers.
Thanks to Konrad Schöbel and Jasper Schulz for helping with the mass-editing.
2011-10-09 10:38:36 +02:00
Victor Stinner a336de7ae1 traceback: fix dump_ascii() for string with kind=PyUnicode_WCHAR_KIND 2011-10-05 22:44:12 +02:00
Martin v. Löwis d63a3b8beb Implement PEP 393. 2011-09-28 07:41:54 +02:00
Victor Stinner fe7c5b5bdf Issue #9319: Include the filename in "Non-UTF8 code ..." syntax error. 2011-04-05 01:48:03 +02:00
Victor Stinner fcb88c4503 Issue #11393: _Py_DumpTraceback() writes the header even if there is no frame 2011-04-01 15:34:01 +02:00
Victor Stinner 024e37adcc Issue #11393: Add the new faulthandler module 2011-03-31 01:31:06 +02:00
Georg Brandl e5b99f0fb3 Remove redundant includes of headers that are already included by Python.h. 2010-11-30 09:41:01 +00:00
Victor Stinner 4c7c8c3023 Issue #9713, #10114: Parser functions (eg. PyParser_ASTFromFile) expects
filenames encoded to the filesystem encoding with surrogateescape error handler
(to support undecodable bytes), instead of UTF-8 in strict mode.
2010-10-16 13:14:10 +00:00
Antoine Pitrou b86680e299 Explicitly close some files (from issue #10093) 2010-10-14 21:15:17 +00:00
Victor Stinner 0fe25a445d Issue #6543: Write the traceback in the terminal encoding instead of utf-8.
Fix the encoding of the modules filename.

Reindent also traceback.h, just because I hate tabs :-)
2010-06-17 23:08:50 +00:00