New submission from STINNER Victor <victor.stin...@gmail.com>: The -X dev mode currently *hides* some ResourceWarning warnings:
$ cat x.py def func(): open('/etc/issue') func() func() $ ./python x.py x.py:2: ResourceWarning: unclosed file <_io.TextIOWrapper name='/etc/issue' mode='r' encoding='UTF-8'> open('/etc/issue') x.py:2: ResourceWarning: unclosed file <_io.TextIOWrapper name='/etc/issue' mode='r' encoding='UTF-8'> open('/etc/issue') haypo@selma$ ./python -X dev x.py x.py:2: ResourceWarning: unclosed file <_io.TextIOWrapper name='/etc/issue' mode='r' encoding='UTF-8'> open('/etc/issue') The problem is that the "-W default" inserted by -X dev overrides the final filter on ResourceWarning: $ ./python -X dev -c 'import warnings, pprint; pprint.pprint(warnings.filters)' [('default', re.compile('', re.IGNORECASE), <class 'Warning'>, re.compile(''), 0), ('ignore', None, <class 'BytesWarning'>, None, 0), ('always', None, <class 'ResourceWarning'>, None, 0)] ---------- messages: 306548 nosy: ncoghlan, serhiy.storchaka, vstinner priority: normal severity: normal status: open title: In developer mode (-X dev), ResourceWarning is only emited once per line numbers versions: Python 3.7 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue32089> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com