diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2016-03-15 21:49:37 +0100 |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2016-03-15 21:49:37 +0100 |
commit | 665f25d9c82c388ce027eb2d55481fa1aad1b1a5 (patch) | |
tree | e4348d8e12acb549a7ec6cec3c27926dd9d813cf /Include/traceback.h | |
parent | 080cc5e896affccb0dcd288c532e177aae5294a8 (diff) | |
download | cpython-665f25d9c82c388ce027eb2d55481fa1aad1b1a5.tar.gz |
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
Diffstat (limited to 'Include/traceback.h')
-rw-r--r-- | Include/traceback.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Include/traceback.h b/Include/traceback.h index 891000c8fe..7c630e33df 100644 --- a/Include/traceback.h +++ b/Include/traceback.h @@ -67,6 +67,24 @@ PyAPI_DATA(const char*) _Py_DumpTracebackThreads( PyThreadState *current_thread); +#ifndef Py_LIMITED_API + +/* Write a Unicode object into the file descriptor fd. Encode the string to + ASCII using the backslashreplace error handler. + + Do nothing if text is not a Unicode object. The function accepts Unicode + string which is not ready (PyUnicode_WCHAR_KIND). + + This function is signal safe. */ +PyAPI_FUNC(void) _Py_DumpASCII(int fd, PyObject *text); + +/* Format an integer as decimal into the file descriptor fd. + + This function is signal safe. */ +PyAPI_FUNC(void) _Py_DumpDecimal(int fd, unsigned long value); + +#endif /* !Py_LIMITED_API */ + #ifdef __cplusplus } #endif |