homepage

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: warnings in interactive sessions
Type: enhancement Stage: needs patch
Components: Library (Lib) Versions: Python 3.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Alan.Cristhian, georg.brandl, lemburg, martin.panter, ncoghlan, serhiy.storchaka
Priority: normal Keywords:

Created on 2006年08月14日 11:03 by lemburg, last changed 2022年04月11日 14:56 by admin.

Messages (5)
msg60969 - (view) Author: Marc-Andre Lemburg (lemburg) * (Python committer) Date: 2006年08月14日 11:03
Carried over from Patch #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.
msg85079 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2009年04月01日 19:14
Not a bad idea, although it would require some work to make it work in a
backwards-compatible fashion.
msg199793 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2013年10月13日 20:26
Is there still any interest in this?
msg306141 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017年11月13日 05:50
Looks reasonable to me. Perhaps we should port the solution from IPython:
https://github.com/ipython/ipython/issues/6611.
msg306180 - (view) Author: Alyssa Coghlan (ncoghlan) * (Python committer) Date: 2017年11月14日 01:01
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__')"
History
Date User Action Args
2022年04月11日 14:56:19adminsetgithub: 43816
2017年11月14日 01:01:29ncoghlansetnosy: + ncoghlan
messages: + msg306180
2017年11月13日 05:50:14serhiy.storchakasetmessages: + msg306141
versions: + Python 3.7, - Python 3.5
2015年02月26日 21:07:12martin.pantersetnosy: + martin.panter
2015年02月26日 13:00:33serhiy.storchakasetnosy: + serhiy.storchaka

versions: + Python 3.5, - Python 3.4
2013年10月13日 22:15:25Alan.Cristhiansetnosy: + Alan.Cristhian
2013年10月13日 20:26:53georg.brandlsetnosy: + georg.brandl
messages: + msg199793
2012年11月18日 19:28:32ezio.melottisetstage: needs patch
versions: + Python 3.4, - Python 3.2
2012年11月17日 17:12:57brett.cannonsetnosy: - brett.cannon
2010年07月10日 06:28:52terry.reedysetversions: + Python 3.2, - Python 2.6
2009年04月01日 19:14:14brett.cannonsetassignee: brett.cannon ->
messages: + msg85079
2009年02月11日 03:08:20ajaksu2setassignee: brett.cannon
type: enhancement
nosy: + brett.cannon
2006年08月14日 11:03:41lemburgcreate

AltStyle によって変換されたページ (->オリジナル) /