diff options
author | Victor Stinner <vstinner@python.org> | 2020-03-25 18:27:36 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-25 18:27:36 (GMT) |
commit | 87d3b9db4ade1aa100ee6f065082cb7e85b8992f (patch) | |
tree | 85d17fff35bc28beb4a7c6e3a82276f2fa3760d5 /Modules/_io | |
parent | ace018ca47c03ca699603341b12781b5329d2eaa (diff) | |
download | cpython-87d3b9db4ade1aa100ee6f065082cb7e85b8992f.zip cpython-87d3b9db4ade1aa100ee6f065082cb7e85b8992f.tar.gz cpython-87d3b9db4ade1aa100ee6f065082cb7e85b8992f.tar.bz2 |
bpo-39882: Add _Py_FatalErrorFormat() function (GH-19157)
Diffstat (limited to 'Modules/_io')
-rw-r--r-- | Modules/_io/bufferedio.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/Modules/_io/bufferedio.c b/Modules/_io/bufferedio.c index f2d0467..6e76db4 100644 --- a/Modules/_io/bufferedio.c +++ b/Modules/_io/bufferedio.c @@ -292,12 +292,11 @@ _enter_buffered_busy(buffered *self) } Py_END_ALLOW_THREADS if (relax_locking && st != PY_LOCK_ACQUIRED) { - PyObject *msgobj = PyUnicode_FromFormat( - "could not acquire lock for %A at interpreter " + PyObject *ascii = PyObject_ASCII((PyObject*)self); + _Py_FatalErrorFormat(__func__, + "could not acquire lock for %s at interpreter " "shutdown, possibly due to daemon threads", - (PyObject *) self); - const char *msg = PyUnicode_AsUTF8(msgobj); - Py_FatalError(msg); + ascii ? PyUnicode_AsUTF8(ascii) : "<ascii(self) failed>"); } return 1; } |