diff options
-rw-r--r-- | Modules/posixmodule.c | 4 | ||||
-rw-r--r-- | Modules/socketmodule.c | 3 |
2 files changed, 4 insertions, 3 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 3f22d14ffb..65b20be468 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -12111,8 +12111,8 @@ ScandirIterator_dealloc(ScandirIterator *iterator) */ ++Py_REFCNT(iterator); PyErr_Fetch(&exc, &val, &tb); - if (PyErr_ResourceWarning((PyObject *)iterator, 1, - "unclosed scandir iterator %R", iterator)) { + if (PyErr_WarnFormat(PyExc_ResourceWarning, 1, + "unclosed scandir iterator %R", iterator)) { /* Spurious errors can appear at shutdown */ if (PyErr_ExceptionMatches(PyExc_Warning)) PyErr_WriteUnraisable((PyObject *) iterator); diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index 657b04b7a6..77a6b313b0 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -4170,7 +4170,8 @@ sock_dealloc(PySocketSockObject *s) Py_ssize_t old_refcount = Py_REFCNT(s); ++Py_REFCNT(s); PyErr_Fetch(&exc, &val, &tb); - if (PyErr_ResourceWarning(s, 1, "unclosed %R", s)) + if (PyErr_WarnFormat(PyExc_ResourceWarning, 1, + "unclosed %R", s)) /* Spurious errors can appear at shutdown */ if (PyErr_ExceptionMatches(PyExc_Warning)) PyErr_WriteUnraisable((PyObject *) s); |