summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio/selector_events.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2016-03-22 23:28:08 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2016-03-22 23:28:08 (GMT)
commite19558af1b6979edf27f7a05a6e47a8b5d113390 (patch)
treef901801a0684eba2f662670a178c43d96918c4db /Lib/asyncio/selector_events.py
parent060f9bb6024580272440f57c612ca34d9beaa169 (diff)
downloadcpython-e19558af1b6979edf27f7a05a6e47a8b5d113390.zip
cpython-e19558af1b6979edf27f7a05a6e47a8b5d113390.tar.gz
cpython-e19558af1b6979edf27f7a05a6e47a8b5d113390.tar.bz2
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/asyncio/selector_events.py')
-rw-r--r--Lib/asyncio/selector_events.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/asyncio/selector_events.py b/Lib/asyncio/selector_events.py
index 812fac1..cbb3625 100644
--- a/Lib/asyncio/selector_events.py
+++ b/Lib/asyncio/selector_events.py
@@ -573,7 +573,8 @@ class _SelectorTransport(transports._FlowControlMixin,
if compat.PY34:
def __del__(self):
if self._sock is not None:
- warnings.warn("unclosed transport %r" % self, ResourceWarning)
+ warnings.warn("unclosed transport %r" % self, ResourceWarning,
+ source=self)
self._sock.close()
def _fatal_error(self, exc, message='Fatal error on transport'):