summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2016-03-15 20:49:37 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2016-03-15 20:49:37 (GMT)
commit89e7cdcb9c124a01c5c3a69e086a0e8b26e65545 (patch)
treeb7cccbac029142a65590883492ad4edae96b7d70 /Include
parentb380010782959bd2d483320ea237ed3b8dd3d4f7 (diff)
downloadcpython-89e7cdcb9c124a01c5c3a69e086a0e8b26e65545.zip
cpython-89e7cdcb9c124a01c5c3a69e086a0e8b26e65545.tar.gz
cpython-89e7cdcb9c124a01c5c3a69e086a0e8b26e65545.tar.bz2
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')
-rw-r--r--Include/traceback.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/Include/traceback.h b/Include/traceback.h
index 891000c..7c630e3 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