mirror of
https://github.com/python/cpython.git
synced 2025-10-17 12:18:23 +00:00
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.
This commit is contained in:
parent
e232025025
commit
314b8787e0
3 changed files with 47 additions and 50 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue