From f664dc58344fc615f8f5649752bf5cb54efe5b3b Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Sat, 19 Mar 2016 02:01:48 +0100 Subject: ResourceWarning: Revert change on socket and scandir io.FileIO has a safe implementation of destructor, but not socket nor scandir. --- Modules/socketmodule.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Modules/socketmodule.c') 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); -- cgit v1.2.1