This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Raise a DeprecationWarning for warnings.showwarning(.., line)
Type: behavior Stage:
Components: Interpreter Core Versions: Python 2.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: brett.cannon Nosy List: benjamin.peterson, brett.cannon
Priority: critical Keywords: easy

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:33adminsetgithub: 46998
2008-05-05 16:59:40brett.cannonsetstatus: open -> closed
resolution: fixed
messages: + msg66273
2008-05-03 21:26:38brett.cannonsetmessages: + msg66174
2008-05-03 21:11:05benjamin.petersonsetnosy: + benjamin.peterson
messages: + msg66173
2008-05-03 20:45:56brett.cannoncreate