[issue22078] io.BufferedReader hides ResourceWarnings when garbage collected
New submission from Claudiu Popa: Given the following example, Python 3.5 doesn't emit any resource warning: import io, gc f = open(a) bufio = io.BufferedReader(f) gc.collect() Here's a small patch that enables this. -- components: IO files: buffered_io_resource_warning.patch keywords: patch messages: 224040 nosy: Claudiu.Popa priority: normal severity: normal status: open title: io.BufferedReader hides ResourceWarnings when garbage collected type: behavior versions: Python 3.5 Added file: http://bugs.python.org/file36107/buffered_io_resource_warning.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22078 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22078] io.BufferedReader hides ResourceWarnings when garbage collected
Serhiy Storchaka added the comment: All works to me. $ ./python -Wall -c open('/dev/null', 'rb') -c:1: ResourceWarning: unclosed file _io.BufferedReader name='/dev/null' -- nosy: +serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22078 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22078] io.BufferedReader hides ResourceWarnings when garbage collected
Claudiu Popa added the comment: That's not the same, try with my example. open(a) will be a TextIOWrapper. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22078 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22078] io.BufferedReader hides ResourceWarnings when garbage collected
Claudiu Popa added the comment: I mean this one: $ python_d -Wall -c f=open('a', 'r'); import io; io.BufferedReader(f) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22078 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22078] io.BufferedReader hides ResourceWarnings when garbage collected
Serhiy Storchaka added the comment: This example is not correct. 1) Argument of BufferedReader should be binary stream. import io, gc f = open('/dev/null') bufio = io.BufferedReader(f) bufio.read(1) Traceback (most recent call last): File stdin, line 1, in module AttributeError: '_io.TextIOWrapper' object has no attribute 'readinto' 2) gc.collect() doesn't collect file streams because references to them are saved in local variables. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22078 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22078] io.BufferedReader hides ResourceWarnings when garbage collected
Claudiu Popa added the comment: You're right, thanks for the new information. You can close the issue then. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22078 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22078] io.BufferedReader hides ResourceWarnings when garbage collected
Changes by Serhiy Storchaka storch...@gmail.com: -- resolution: - not a bug stage: - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22078 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com