[Python-Dev] PEP 565: Show DeprecationWarning in __main__
Guido van Rossum
guido at python.org
Tue Dec 12 18:24:52 EST 2017
OK, in that case I'll just pronounce approval right here. Considered
disagreement is acceptable.
Nick, congrats with PEP 565! Please update the PEP to mark it as approved
with a link to this message as the resolution, and let's get the
implementation into 3.7a4!
On Tue, Dec 12, 2017 at 2:58 PM, Victor Stinner <victor.stinner at gmail.com>
wrote:
> 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
>
--
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20171212/33561919/attachment.html>
More information about the Python-Dev
mailing list