summaryrefslogtreecommitdiffstats
path: root/Python/traceback.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2021-01-18 17:34:56 (GMT)
committerGitHub <noreply@github.com>2021-01-18 17:34:56 (GMT)
commit314b8787e0c50985ba708034b84ff5b37a1d47de (patch)
tree12941638dbc2d4ad82496a56491b1c3504a79f41 /Python/traceback.c
parente232025025c8bd07c1d1b12a583a80c4a673f077 (diff)
downloadcpython-314b8787e0c50985ba708034b84ff5b37a1d47de.zip
cpython-314b8787e0c50985ba708034b84ff5b37a1d47de.tar.gz
cpython-314b8787e0c50985ba708034b84ff5b37a1d47de.tar.bz2
bpo-42923: Py_FatalError() avoids fprintf() (GH-24242)
* Replace buffered fprintf() with unbuffered _Py_write_noraise() in Py_FatalError(). * _Py_DumpHexadecimal() now accepts uintptr_t.
Diffstat (limited to 'Python/traceback.c')
-rw-r--r--Python/traceback.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/Python/traceback.c b/Python/traceback.c
index b82cfd3..bd5fd35 100644
--- a/Python/traceback.c
+++ b/Python/traceback.c
@@ -649,15 +649,12 @@ _Py_DumpDecimal(int fd, unsigned long value)
_Py_write_noraise(fd, ptr, end - ptr);
}
-/* Format an integer in range [0; 0xffffffff] to hexadecimal of 'width' digits,
- and write it into the file fd.
-
- This function is signal safe. */
-
+/* Format an integer as hexadecimal with width digits into fd file descriptor.
+ The function is signal safe. */
void
-_Py_DumpHexadecimal(int fd, unsigned long value, Py_ssize_t width)
+_Py_DumpHexadecimal(int fd, uintptr_t value, Py_ssize_t width)
{
- char buffer[sizeof(unsigned long) * 2 + 1], *ptr, *end;
+ char buffer[sizeof(uintptr_t) * 2 + 1], *ptr, *end;
const Py_ssize_t size = Py_ARRAY_LENGTH(buffer) - 1;
if (width > size)