[Python-Dev] PEP 565: Show DeprecationWarning in main (original) (raw)
Victor Stinner victor.stinner at gmail.com
Tue Dec 12 17:58:21 EST 2017
- Previous message (by thread): [Python-Dev] PEP 565: Show DeprecationWarning in __main__
- Next message (by thread): [Python-Dev] PEP 565: Show DeprecationWarning in __main__
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi,
2017-12-12 21:21 GMT+01:00 Guido van Rossum <guido at python.org>:
I'm still hoping to accept this PEP, but I don't have time to wrap my head around -Xdev ("devmode"?) which appears to be Victor's latest pet project. Should PEP 565 be changed to copy with devmode's behavior, or the other way around, or should they just ignore each other? It is not clear of me what the status of the mention in PEP 565 of -Xdev is -- normative or informational? I really don't want to have to learn how devmode works in order to be able to accept PEP 565 (or send it back for revision), so I am asking you two to let me know.
The warnings filters had a few corner cases. We discussed with Nick to fix them to make them simpler. We agreed on these priorities for command line options and environment variables:
-b and -bb > -W > PYTHONWARNINGS > -X dev > default filters
In release mode, the default filters became:
ignore::DeprecationWarning
ignore::PendingDeprecationWarning
ignore::ImportWarning
ignore::ResourceWarning
ignore::BytesWarning is gone. We now rely on the fact the BytesWarning should not be emited without -b nor -bb in practice.
It has been implemented in https://bugs.python.org/issue32230 ! (I just merged Nick's PR.)
Now -X dev behaves again as my initial propopal: for warnings, "-X dev" simply behaves as "-W default". (Previously, I had to hack the code to respect -b and -bb options, but I don't think that it's worth it to explain that here, it's doesn't matter anymore ;-))
The PEP 565 is still different: it doesn't behaves as "-W default", but "-W default::DeprecationWarning:main". Only DeprecationWarning warnings are shown, whereas -X dev shows DeprecationWarning, but also PendingDeprecationWarning, ResourceWarning and ImportWarning. Moreover, -X dev shows warnings in all modules, not only main.
You may see -X dev as a builtin linter, whereas PEP 565 seems to be very specific to one specific issue: display deprecation warnings, but only in the main module.
Does it help you to understand the difference?
Note: I still dislike the PEP 565, but well, that's just my opinion ;-)
Victor
- Previous message (by thread): [Python-Dev] PEP 565: Show DeprecationWarning in __main__
- Next message (by thread): [Python-Dev] PEP 565: Show DeprecationWarning in __main__
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]