classification
Title: Idle doesn't obey the new improved warnings arguements
Type: behavior Stage:
Components: IDLE, Library (Lib) Versions: Python 3.0, Python 2.6
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: Nosy List: amaury.forgeotdarc, gpolo, scott_daniels
Priority: normal Keywords: patch

Created on 2008-09-21 23:52 by scott_daniels, last changed 2009-08-14 15:08 by gpolo. This issue is now closed.

Files
File name Uploaded Description Edit
diff_trunk scott_daniels, 2008-09-27 23:32 File contains diffs for changes described above.
test_idle_warnings.py scott_daniels, 2008-09-27 23:33 Test for (most of) discovered issues.
parts.zip scott_daniels, 2008-11-23 23:32 Code and differs for Py
idle_fixwarnings.diff gpolo, 2009-08-03 15:44
Messages (10)
msg73541 - (view) Author: Scott David Daniels (scott_daniels) * Date: 2008-09-21 23:52
Idle doesn't accept the new improved warnings arguments, thus escalating
warnings to failures.  This is, I believe, the core reason that Idle was
failing on windows (warnings about deprecated set_daemon call escalated
to a failure).

Files affected: idlelib/PyShell.py and idlelib/run.py

On chasing this, it looks like the code in warnings.py is masking 
IOErrors a little too broadly, so we should probably also narrow the
exception handling in warnings.py

Patch coming, but not ready just yet.
msg73581 - (view) Author: Guilherme Polo (gpolo) * (Python committer) Date: 2008-09-22 14:51
The first part was already mentioned in issue3391, but not closing this
in favor of the second part of your message.
msg73631 - (view) Author: Scott David Daniels (scott_daniels) * Date: 2008-09-23 12:45
I found that patch, but it confuses showwarning and formatwarning 
parameter changes.
msg73946 - (view) Author: Scott David Daniels (scott_daniels) * Date: 2008-09-27 23:32
OK, Issues:
1) warnings.py 
    I/O errors in formatwarning will be masked and misinterpreted as
failures to write on stderr, and no output will be attempted.  

2) warnings.py
A line with of whitespace will be shown, rather than suppressed.

3) idlelib/PyShell.py 
idle_show_warning did not take new args to showwarning.
& a repeat of an error much like 1.

3) idlelib/PyShell.py
idle_format_warning did not take new arg to formatwarning.

4) idlelib/PyShell.py
extended_linecache_checkcache did not pass its arg along to 
orig_checkcache.  Had to rename the element in the loop to
avoid trashing the arg.

5) idlelib/run.py
idle_formatwarning_subproc must also follow the new protocol for 
formatwarning.
msg73947 - (view) Author: Scott David Daniels (scott_daniels) * Date: 2008-09-27 23:33
Here is a test for the fixes provided.
msg76191 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2008-11-21 16:47
This is already corrected by r66922 (issue3391), but the patches are
different and there are some things I don't like in the present
implementation:

- in idle_showwarning, the "file" argument is ignored and always
replaced by warning_stream.
- warnings.formatwarning is passed a "file" argument: this could fail,
but works only because the function is monkey-patched. But "file" is not
even used there!

The attached patch seems better, but does not apply cleanly any more.
msg76280 - (view) Author: Scott David Daniels (scott_daniels) * Date: 2008-11-23 23:32
Attached parts.zip -- a zip of updates for Python 2.6 and Python 3.0
against the current source [zip has two 

For Python 2.6:
py26/diff_py26.txt  -- differ against python26-maint tree
py26/PyShell.py     -- Replacement file for .../Lib/idlelib/PyShell.py
py26/run.py         -- Replacement file for .../Lib/idlelib/run.py

For Python 3.0:
py30/py3k_diff.txt  -- differ against python3k tree
py30/PyShell.py     -- Replacement file for .../Lib/idlelib/PyShell.py
py30/run.py         -- Replacement file for .../Lib/idlelib/run.py
msg91223 - (view) Author: Guilherme Polo (gpolo) * (Python committer) Date: 2009-08-03 15:44
This looks good Scott, I'm just attaching the .diff here with real minor
changes and will be applying if no one is against it.
msg91550 - (view) Author: Guilherme Polo (gpolo) * (Python committer) Date: 2009-08-14 14:03
Committed on r74447, will merge into py3k.
msg91554 - (view) Author: Guilherme Polo (gpolo) * (Python committer) Date: 2009-08-14 15:08
> Committed on r74447, will merge into py3k.

py3k: r74450
History
Date User Action Args
2009-08-14 15:08:03gpolosetmessages: + msg91554
2009-08-14 14:03:46gpolosetstatus: open -> closed
resolution: accepted
messages: + msg91550
2009-08-03 15:44:35gpolosetfiles: + idle_fixwarnings.diff
keywords: + patch
messages: + msg91223
2008-11-23 23:32:22scott_danielssetfiles: + parts.zip
messages: + msg76280
2008-11-21 16:47:19amaury.forgeotdarcsetnosy: + amaury.forgeotdarc
messages: + msg76191
2008-09-27 23:33:41scott_danielssetfiles: + test_idle_warnings.py
messages: + msg73947
2008-09-27 23:32:04scott_danielssetfiles: + diff_trunk
messages: + msg73946
components: + IDLE, Library (Lib)
2008-09-23 12:45:54scott_danielssetmessages: + msg73631
2008-09-22 14:51:06gpolosetnosy: + gpolo
messages: + msg73581
2008-09-21 23:52:15scott_danielscreate