From e19558af1b6979edf27f7a05a6e47a8b5d113390 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 23 Mar 2016 00:28:08 +0100 Subject: Add a source parameter to warnings.warn() Issue #26604: * Add a new optional source parameter to _warnings.warn() and warnings.warn() * Modify asyncore, asyncio and _pyio modules to set the source parameter when logging a ResourceWarning warning --- Lib/asyncio/windows_utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Lib/asyncio/windows_utils.py') diff --git a/Lib/asyncio/windows_utils.py b/Lib/asyncio/windows_utils.py index 870cd13abe..7c63fb904b 100644 --- a/Lib/asyncio/windows_utils.py +++ b/Lib/asyncio/windows_utils.py @@ -159,7 +159,8 @@ class PipeHandle: def __del__(self): if self._handle is not None: - warnings.warn("unclosed %r" % self, ResourceWarning) + warnings.warn("unclosed %r" % self, ResourceWarning, + source=self) self.close() def __enter__(self): -- cgit v1.2.1