Unverified Kaydet (Commit) 35103343 authored tarafından Yury Selivanov's avatar Yury Selivanov Kaydeden (comit) GitHub

bpo-32591: Fix PyExc_WarnFormat call (follow-up commit) (#5263)

The previous version was correct in terms of behaviour, but
checking the return value of PyErr_WarnFormat allows to
avoid calling PyErr_Occurred and silences the coverity alarm.
üst a4afcdfa
...@@ -1191,11 +1191,10 @@ _PyErr_WarnUnawaitedCoroutine(PyObject *coro) ...@@ -1191,11 +1191,10 @@ _PyErr_WarnUnawaitedCoroutine(PyObject *coro)
PyErr_WriteUnraisable(coro); PyErr_WriteUnraisable(coro);
} }
if (!warned) { if (!warned) {
PyErr_WarnFormat(PyExc_RuntimeWarning, 1, if (PyErr_WarnFormat(PyExc_RuntimeWarning, 1,
"coroutine '%.50S' was never awaited", "coroutine '%.50S' was never awaited",
((PyCoroObject *)coro)->cr_qualname); ((PyCoroObject *)coro)->cr_qualname) < 0)
/* Maybe *that* got converted into an exception */ {
if (PyErr_Occurred()) {
PyErr_WriteUnraisable(coro); PyErr_WriteUnraisable(coro);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment