In order to move the warnings.showwarning() API forward to support the new 'line' argument, a DeprecationWarning is needed for implementations that lack support for it. From the Python side a simple check for the 'line' argument using 'inspect' will work. For the C side, a check that there is more than 1 default argument should suffice, although a quick check of what other ways to introspect Python function objects from C code should be done first before settling on this solution.
On Sat, May 3, 2008 at 2:11 PM, Benjamin Peterson <report@bugs.python.org> wrote: > > Benjamin Peterson <musiccomposition@gmail.com> added the comment: > > Brett, can you list the places showwarning is used? > Lib/warnings.py and Python/_warnings.c. In both cases just search for "showwarning"; there is only a single call site in both files.
r62720 and r62722 have the fix (and a fix for the fix). In the Python code I check for an argument named 'line' and in the C code I make sure there are at least two default arguments. Both assume a Python implementation for showwarning(), which should be a reasonable assumption.
History
Date
User
Action
Args
2022-04-11 14:56:33
admin
set
github: 46998
2008-05-05 16:59:40
brett.cannon
set
status: open -> closedresolution: fixedmessages: +