[Python-Dev] Make stacklevel=2 by default in warnings.warn()
Victor Stinner
victor.stinner at gmail.com
Mon Sep 21 09:14:07 CEST 2015
Would it be too verbose to display two frames or more by default?
Maybe depending on the action (ex: only if the warning is emitted only
once).
Victor
2015-09-20 8:44 GMT+02:00 Serhiy Storchaka <storchaka at gmail.com>:
> For now the default value of the stacklevel parameter in warnings.warn() is
> 1. But in most cases stacklevel=2 is required, sometimes >2, and I don't
> know cases that need stacklevel=1. I propose to make the default value of
> stacklevel to be 2. I think that unlikely this will break existing code. But
> rather can fix existing bugs. If stacklevel=1 is required (I don't know
> cases), it can be explicitly specified.
>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
> https://mail.python.org/mailman/options/python-dev/victor.stinner%40gmail.com
More information about the Python-Dev
mailing list