[Python-Dev] Make stacklevel=2 by default in warnings.warn() (original) (raw)
Victor Stinner victor.stinner at gmail.com
Mon Sep 21 09:14:07 CEST 2015
- Previous message (by thread): [Python-Dev] Make stacklevel=2 by default in warnings.warn()
- Next message (by thread): [Python-Dev] Make stacklevel=2 by default in warnings.warn()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Previous message (by thread): [Python-Dev] Make stacklevel=2 by default in warnings.warn()
- Next message (by thread): [Python-Dev] Make stacklevel=2 by default in warnings.warn()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]