diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2016-03-23 00:28:08 +0100 |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2016-03-23 00:28:08 +0100 |
commit | e19558af1b6979edf27f7a05a6e47a8b5d113390 (patch) | |
tree | f901801a0684eba2f662670a178c43d96918c4db /Lib/asyncore.py | |
parent | Fix macros in hashtable.h (diff) | |
download | cpython-e19558af1b6979edf27f7a05a6e47a8b5d113390.tar.gz cpython-e19558af1b6979edf27f7a05a6e47a8b5d113390.tar.bz2 cpython-e19558af1b6979edf27f7a05a6e47a8b5d113390.zip |
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
Diffstat (limited to 'Lib/asyncore.py')
-rw-r--r-- | Lib/asyncore.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/asyncore.py b/Lib/asyncore.py index 3b51f0f337f..4b046d67e39 100644 --- a/Lib/asyncore.py +++ b/Lib/asyncore.py @@ -595,7 +595,8 @@ if os.name == 'posix': def __del__(self): if self.fd >= 0: - warnings.warn("unclosed file %r" % self, ResourceWarning) + warnings.warn("unclosed file %r" % self, ResourceWarning, + source=self) self.close() def recv(self, *args): |