Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raise a DeprecationWarning for warnings.showwarning(.., line) #46998

Closed
brettcannon opened this issue May 3, 2008 · 4 comments
Closed

Raise a DeprecationWarning for warnings.showwarning(.., line) #46998

brettcannon opened this issue May 3, 2008 · 4 comments
Assignees
Labels
easy interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error

Comments

@brettcannon
Copy link
Member

BPO 2749
Nosy @brettcannon, @benjaminp

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = 'https://github.com/brettcannon'
closed_at = <Date 2008-05-05.16:59:40.927>
created_at = <Date 2008-05-03.20:45:56.065>
labels = ['interpreter-core', 'easy', 'type-bug']
title = 'Raise a DeprecationWarning for warnings.showwarning(.., line)'
updated_at = <Date 2008-05-05.16:59:40.926>
user = 'https://github.com/brettcannon'

bugs.python.org fields:

activity = <Date 2008-05-05.16:59:40.926>
actor = 'brett.cannon'
assignee = 'brett.cannon'
closed = True
closed_date = <Date 2008-05-05.16:59:40.927>
closer = 'brett.cannon'
components = ['Interpreter Core']
creation = <Date 2008-05-03.20:45:56.065>
creator = 'brett.cannon'
dependencies = []
files = []
hgrepos = []
issue_num = 2749
keywords = ['easy']
message_count = 4.0
messages = ['66172', '66173', '66174', '66273']
nosy_count = 2.0
nosy_names = ['brett.cannon', 'benjamin.peterson']
pr_nums = []
priority = 'critical'
resolution = 'fixed'
stage = None
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue2749'
versions = ['Python 2.6']

@brettcannon
Copy link
Member Author

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.

@brettcannon brettcannon self-assigned this May 3, 2008
@brettcannon brettcannon added interpreter-core (Objects, Python, Grammar, and Parser dirs) easy type-bug An unexpected behavior, bug, or error labels May 3, 2008
@benjaminp
Copy link
Contributor

Brett, can you list the places showwarning is used?

@brettcannon
Copy link
Member Author

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.

@brettcannon
Copy link
Member Author

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.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
easy interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants