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

warnings in interactive sessions #43816

Open
malemburg opened this issue Aug 14, 2006 · 5 comments
Open

warnings in interactive sessions #43816

malemburg opened this issue Aug 14, 2006 · 5 comments
Labels
3.13 bugs and security fixes stdlib Python modules in the Lib dir topic-repl Related to the interactive shell type-feature A feature request or enhancement

Comments

@malemburg
Copy link
Member

BPO 1539925
Nosy @malemburg, @birkenfeld, @ncoghlan, @vadmium, @serhiy-storchaka

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 = None
closed_at = None
created_at = <Date 2006-08-14.11:03:41.000>
labels = ['3.7', 'type-feature', 'library']
title = 'warnings in interactive sessions'
updated_at = <Date 2017-11-14.01:01:29.867>
user = 'https://github.com/malemburg'

bugs.python.org fields:

activity = <Date 2017-11-14.01:01:29.867>
actor = 'ncoghlan'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['Library (Lib)']
creation = <Date 2006-08-14.11:03:41.000>
creator = 'lemburg'
dependencies = []
files = []
hgrepos = []
issue_num = 1539925
keywords = []
message_count = 5.0
messages = ['60969', '85079', '199793', '306141', '306180']
nosy_count = 6.0
nosy_names = ['lemburg', 'georg.brandl', 'ncoghlan', 'martin.panter', 'serhiy.storchaka', 'Alan.Cristhian']
pr_nums = []
priority = 'normal'
resolution = None
stage = 'needs patch'
status = 'open'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue1539925'
versions = ['Python 3.7']

@malemburg
Copy link
Member Author

Carried over from Patch bpo-1538956 description:

During testing I found that the warning registry
defaults to only issueing warnings once per module and
line number.

I suppose this is enough for debugging code, but it
feels weird when trying things in the interactive
session, as you only get the warnings once in that
context (and for the whole session), regardless of the
fact that you're entering new lines of code all the time.

The reason is that the warning framework registers
warnings based on line number which usually is 1 in
interactive sessions.

In general, it might be a better idea to have a single
global warning registry and then include the module
name or id in the registry key. Currently, the warning
framework creates a new registry per (module) context.

@malemburg malemburg added stdlib Python modules in the Lib dir labels Aug 14, 2006
@devdanzin devdanzin mannequin assigned brettcannon Feb 11, 2009
@devdanzin devdanzin mannequin added the type-feature A feature request or enhancement label Feb 11, 2009
@devdanzin devdanzin mannequin assigned brettcannon Feb 11, 2009
@brettcannon
Copy link
Member

Not a bad idea, although it would require some work to make it work in a
backwards-compatible fashion.

@brettcannon brettcannon removed their assignment Apr 1, 2009
@birkenfeld
Copy link
Member

Is there still any interest in this?

@serhiy-storchaka
Copy link
Member

Looks reasonable to me. Perhaps we should port the solution from IPython:
ipython/ipython#6611.

@serhiy-storchaka serhiy-storchaka added the 3.7 (EOL) end of life label Nov 13, 2017
@ncoghlan
Copy link
Contributor

As a user, what would I actually gain from being warned more than once per session that a particular API I'm using is deprecated?

If I want that behaviour, I can already opt in to it by doing "warnings.simplefilter('always')".

As things stand, the perpetually reset line counter just means that the effective default at the REPL is "warnings.simplefilter('module:::main')"

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
@iritkatriel iritkatriel added 3.12 bugs and security fixes and removed 3.7 (EOL) end of life labels Oct 5, 2022
@iritkatriel iritkatriel added 3.13 bugs and security fixes and removed 3.12 bugs and security fixes labels May 14, 2023
@AlexWaygood AlexWaygood added the topic-repl Related to the interactive shell label May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.13 bugs and security fixes stdlib Python modules in the Lib dir topic-repl Related to the interactive shell type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

7 participants