Skip to content

Commit 49127c6

Browse files
authored
Use PyErr_FormatUnraisable() on Python 3.13 (#34)
Use the new public PyErr_FormatUnraisable() on Python 3.13. The private _PyErr_WriteUnraisableMsg() function was removed in Python 3.13: python/cpython#111643
1 parent a490b4b commit 49127c6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/c/_cffi_backend.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6118,7 +6118,11 @@ static void _my_PyErr_WriteUnraisable(PyObject *t, PyObject *v, PyObject *tb,
61186118

61196119
PyErr_Restore(t, v, tb);
61206120
if (s != NULL) {
6121+
#if PY_VERSION_HEX >= 0x030D0000
6122+
PyErr_FormatUnraisable("Exception ignored %S", s);
6123+
#else
61216124
_PyErr_WriteUnraisableMsg(PyText_AS_UTF8(s), NULL);
6125+
#endif
61226126
Py_DECREF(s);
61236127
}
61246128
else

0 commit comments

Comments
 (0)