Message346129
Current behaviour
$ cat foo.py
def foo():
open('foo', 'wb')
foo()
$ python3.8 -W all::ResourceWarning -X tracemalloc=5 foo.py
foo.py:2: ResourceWarning: unclosed file <_io.BufferedWriter name='foo'>
open('foo', 'wb')
Object allocated at (most recent call last):
File "foo.py", lineno 5
foo()
File "foo.py", lineno 2
open('foo', 'wb')
$ python3.8 -W error -X tracemalloc=5 foo.py
Exception ignored in: <_io.FileIO name='foo' mode='wb' closefd=True>
ResourceWarning: unclosed file <_io.BufferedWriter name='foo'>
Expected behaviour
# Pastebin Eu0gvZ5Z
$ cat foo.py
def foo():
open('foo', 'wb')
foo()
$ python3.8 -W all::ResourceWarning -X tracemalloc=5 foo.py
foo.py:2: ResourceWarning: unclosed file <_io.BufferedWriter name='foo'>
open('foo', 'wb')
Object allocated at (most recent call last):
File "foo.py", lineno 5
foo()
File "foo.py", lineno 2
open('foo', 'wb')
$ python3.8 -W error -X tracemalloc=5 foo.py
Exception ignored in: <_io.FileIO name='foo' mode='wb' closefd=True>
ResourceWarning: unclosed file <_io.BufferedWriter name='foo'>
open('foo', 'wb')
Object allocated at (most recent call last):
File "foo.py", lineno 5
foo()
File "foo.py", lineno 2
open('foo', 'wb') |
|
Date |
User |
Action |
Args |
2019-06-20 16:16:27 | graingert | set | recipients:
+ graingert |
2019-06-20 16:16:27 | graingert | set | messageid: <1561047387.04.0.201074176939.issue37350@roundup.psfhosted.org> |
2019-06-20 16:16:27 | graingert | link | issue37350 messages |
2019-06-20 16:16:26 | graingert | create | |
|