summaryrefslogtreecommitdiff
path: root/Lib/_pyio.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2016-03-23 00:28:08 +0100
committerVictor Stinner <victor.stinner@gmail.com>2016-03-23 00:28:08 +0100
commite19558af1b6979edf27f7a05a6e47a8b5d113390 (patch)
treef901801a0684eba2f662670a178c43d96918c4db /Lib/_pyio.py
parent060f9bb6024580272440f57c612ca34d9beaa169 (diff)
downloadcpython-git-e19558af1b6979edf27f7a05a6e47a8b5d113390.tar.gz
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/_pyio.py')
-rw-r--r--Lib/_pyio.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/_pyio.py b/Lib/_pyio.py
index c3ad81e6db..972c082803 100644
--- a/Lib/_pyio.py
+++ b/Lib/_pyio.py
@@ -1514,7 +1514,7 @@ class FileIO(RawIOBase):
if self._fd >= 0 and self._closefd and not self.closed:
import warnings
warnings.warn('unclosed file %r' % (self,), ResourceWarning,
- stacklevel=2)
+ stacklevel=2, source=self)
self.close()
def __getstate__(self):