[issue32089] In developer mode (-X dev), ResourceWarning is only emited once per line numbers

2017-11-27 Thread STINNER Victor
STINNER Victor added the comment: The "default warning filters" are documented, but only for Python compiled in release mode: https://docs.python.org/dev/library/warnings.html#default-warning-filters So I didn't touch this documentation. The initial issue is now

[issue32089] In developer mode (-X dev), ResourceWarning is only emited once per line numbers

2017-11-27 Thread STINNER Victor
STINNER Victor added the comment: New changeset 21c7730761e2a768e33b89b063a095d007dcfd2c by Victor Stinner in branch 'master': bpo-32089: Use default action for ResourceWarning (#4584) https://github.com/python/cpython/commit/21c7730761e2a768e33b89b063a095d007dcfd2c

[issue32089] In developer mode (-X dev), ResourceWarning is only emited once per line numbers

2017-11-27 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +4507 stage: resolved -> patch review ___ Python tracker ___

[issue32089] In developer mode (-X dev), ResourceWarning is only emited once per line numbers

2017-11-24 Thread Nick Coghlan
Nick Coghlan added the comment: +1 from me for using "default" instead of "always" for ResourceWarning. Folks can always combine "-X tracemalloc" with "-W always::ResourceWarning" if want to ensure they see absolutely every resource warning, rather than only

[issue32089] In developer mode (-X dev), ResourceWarning is only emited once per line numbers

2017-11-24 Thread Antoine Pitrou
Antoine Pitrou added the comment: > Antoine: What do you think of using the "default" action for pydebug build > and -X dev? That would be fine with me. -- ___ Python tracker

[issue32089] In developer mode (-X dev), ResourceWarning is only emited once per line numbers

2017-11-23 Thread STINNER Victor
STINNER Victor added the comment: Antoine: What do you think of using the "default" action for pydebug build and -X dev? -- ___ Python tracker

[issue32089] In developer mode (-X dev), ResourceWarning is only emited once per line numbers

2017-11-21 Thread STINNER Victor
STINNER Victor added the comment: Antoine: > If they have different names, they will be logged separately. Oh wow, nice behaviour, I like it :-) Antoine: >> For ResourceWarning, your rationale only concerns pydebug build, no? > Why? I'm talking about "-X dev", not

[issue32089] In developer mode (-X dev), ResourceWarning is only emited once per line numbers

2017-11-21 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: See also issue27535. -- ___ Python tracker ___

[issue32089] In developer mode (-X dev), ResourceWarning is only emited once per line numbers

2017-11-21 Thread Antoine Pitrou
Antoine Pitrou added the comment: I forgot: the snippet above was made with "python -Wdefault::ResourceWarning". -- ___ Python tracker

[issue32089] In developer mode (-X dev), ResourceWarning is only emited once per line numbers

2017-11-21 Thread Antoine Pitrou
Antoine Pitrou added the comment: Le 21/11/2017 à 14:46, STINNER Victor a écrit : > > I don't know the rationale of the "always" action rather than "default". Neither do I. But I don't think it matters a lot. pydebug builds are almost only used by Python core developers.

[issue32089] In developer mode (-X dev), ResourceWarning is only emited once per line numbers

2017-11-21 Thread STINNER Victor
STINNER Victor added the comment: > If a program calls func() 1000 times in a row, they will show the same > warning 1000 times. What does it bring to have the exact same warning (and > line number) displayed 1000 times instead of once? Nothing. There is a >

[issue32089] In developer mode (-X dev), ResourceWarning is only emited once per line numbers

2017-11-21 Thread Antoine Pitrou
Antoine Pitrou added the comment: I don't agree with this. You're comparing "-X dev" with a pydebug build of Python, not with a normal Python. Your example shows the problem. If a program calls func() 1000 times in a row, they will show the same warning 1000 times. What

[issue32089] In developer mode (-X dev), ResourceWarning is only emited once per line numbers

2017-11-20 Thread STINNER Victor
Change by STINNER Victor : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker

[issue32089] In developer mode (-X dev), ResourceWarning is only emited once per line numbers

2017-11-20 Thread STINNER Victor
STINNER Victor added the comment: New changeset 09f3a8a1249308a104a89041d82fe99e6c087043 by Victor Stinner in branch 'master': bpo-32089: Fix warnings filters in dev mode (#4482) https://github.com/python/cpython/commit/09f3a8a1249308a104a89041d82fe99e6c087043

[issue32089] In developer mode (-X dev), ResourceWarning is only emited once per line numbers

2017-11-20 Thread STINNER Victor
STINNER Victor added the comment: Attached PR 4482 fixes warnings filters: haypo@selma$ ./python -X dev -c 'import warnings, pprint; pprint.pprint(warnings.filters)' [('ignore', None, , None, 0), ('always', None, , None, 0), ('default', None, , None, 0)]

[issue32089] In developer mode (-X dev), ResourceWarning is only emited once per line numbers

2017-11-20 Thread STINNER Victor
Change by STINNER Victor : -- nosy: +pitrou ___ Python tracker ___ ___

[issue32089] In developer mode (-X dev), ResourceWarning is only emited once per line numbers

2017-11-20 Thread STINNER Victor
Change by STINNER Victor : -- keywords: +patch pull_requests: +4419 stage: -> patch review ___ Python tracker ___

[issue32089] In developer mode (-X dev), ResourceWarning is only emited once per line numbers

2017-11-20 Thread STINNER Victor
New submission from STINNER Victor : 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'