[Python-Dev] Proposal: go back to enabling DeprecationWarning by default (original) (raw)
Nick Coghlan ncoghlan at gmail.com
Sat Nov 11 02:00:36 EST 2017
- Previous message (by thread): [Python-Dev] Proposal: go back to enabling DeprecationWarning by default
- Next message (by thread): [Python-Dev] Proposal: go back to enabling DeprecationWarning by default
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 11 November 2017 at 02:02, Random832 <random832 at fastmail.com> wrote:
On Tue, Nov 7, 2017, at 07:22, Nick Coghlan wrote:
My suggestion for that definition is to have the default meaning of "third party code" be "everything that isn't main". What is main? Or, rather, how do you determine when it is to blame? For syntax it's easy, but any deprecated function necessarily belongs to its own module and not to main. Main may have called it, which can be detected from the stack trace, or it may have used it in some other way (pass to some builtin or e.g. itertools function that takes a callable argument, for example).
The warnings machinery already defines how this works (look for "stacklevel"). For callbacks defined as Python code, the deprecated call will be attributed to whichever module defined the callback, not the machinery that called the callback.
Cheers, Nick.
-- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
- Previous message (by thread): [Python-Dev] Proposal: go back to enabling DeprecationWarning by default
- Next message (by thread): [Python-Dev] Proposal: go back to enabling DeprecationWarning by default
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]