Issue 2749: Raise a DeprecationWarning for warnings.showwarning(.., line) (original) (raw)

Created on 2008-05-03 20:45 by brett.cannon, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (4)
msg66172 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2008-05-03 20:45
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.
msg66173 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2008-05-03 21:11
Brett, can you list the places showwarning is used?
msg66174 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2008-05-03 21:26
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.
msg66273 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2008-05-05 16:59
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: +
2008-05-03 21:26:38 brett.cannon set messages: +
2008-05-03 21:11:05 benjamin.peterson set nosy: + benjamin.petersonmessages: +
2008-05-03 20:45:56 brett.cannon create