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.
Created on 2012年07月10日 02:27 by roger.serwy, last changed 2022年04月11日 14:57 by admin.
| Messages (5) | |||
|---|---|---|---|
| msg165145 - (view) | Author: Roger Serwy (roger.serwy) * (Python committer) | Date: 2012年07月10日 02:29 | |
There are a lot of bare exceptions in IDLE. Here's the output of "grep -n 'except:' *.py" AutoComplete.py:184: except: AutoComplete.py:209: except: Debugger.py:172: except: Debugger.py:344: except: EditorWindow.py:999: except: ObjectBrowser.py:38: except: ObjectBrowser.py:100: except: PyShell.py:133: except: # but debugger may not be active right now.... PyShell.py:154: except: PyShell.py:161: except: PyShell.py:176: except: PyShell.py:433: except: PyShell.py:742: except: PyShell.py:869: except: PyShell.py:1043: except: PyShell.py:1096: except: PyShell.py:1193: except: PyShell.py:1214: except: PyShell.py:1245: except: rpc.py:106: except: rpc.py:206: except: run.py:88: except: run.py:120: except: run.py:125: except: run.py:248: except: run.py:332: except: SearchEngine.py:72: except: StackViewer.py:66: except: WindowList.py:47: except: Slowly, these exceptions should be refined to include the exact exception being caught. |
|||
| msg165157 - (view) | Author: Terry J. Reedy (terry.reedy) * (Python committer) | Date: 2012年07月10日 04:17 | |
And possibly change the except clause. The except clause at PyShell 1245 was 'pass', which masked the issue of #13532 and was changed to 'raise' to effectively remove the try: except: to make the unknown problem more visible. It should perhaps be really removed if and when all calls to PyShell.write(s) are properly guarded to make sure 's' is writable. |
|||
| msg165162 - (view) | Author: Roger Serwy (roger.serwy) * (Python committer) | Date: 2012年07月10日 05:18 | |
Line 1245 is part of this code (in time, these line numbers will change.)
try:
self.text.mark_gravity("iomark", "right")
OutputWindow.write(self, s, tags, "iomark")
self.text.mark_gravity("iomark", "left")
except:
raise ###pass # ### 11Aug07 KBK if we are expecting exceptions
# let's find out what they are and be specific.
The delegator chain that sits between OutputWindow.write and the Tkinter text.insert method can raise any error. (The ColorDelegator would raise a TypeError when "s" was not a string). I'd rather not replace this with "except Exception:" since the delegators should catch their own errors.
I suggest removing this try/catch block.
|
|||
| msg165163 - (view) | Author: Roger Serwy (roger.serwy) * (Python committer) | Date: 2012年07月10日 05:20 | |
Also, issue13582 will become relevant on Windows since modifying the bare excepts may let uncaught exceptions be written to stderr, causing IDLE to crash. |
|||
| msg202449 - (view) | Author: Terry J. Reedy (terry.reedy) * (Python committer) | Date: 2013年11月08日 22:40 | |
RA's patch for #16261 suggests diff -r b76d2d8db81f Lib/idlelib/PyShell.py --- a/Lib/idlelib/PyShell.py Mon Dec 17 13:43:14 2012 +0530 +++ b/Lib/idlelib/PyShell.py Wed Jan 09 19:10:26 2013 +0530 @@ -152,7 +152,7 @@ lineno = int(float(text.index("insert"))) try: self.breakpoints.remove(lineno) - except: + except ValueError: pass text.tag_remove("BREAK", "insert linestart",\ "insert lineend +1char") |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:32 | admin | set | github: 59518 |
| 2017年06月30日 01:02:35 | terry.reedy | set | assignee: terry.reedy stage: needs patch versions: + Python 3.6, Python 3.7, - Python 2.7, Python 3.3, Python 3.4 |
| 2013年11月08日 22:40:09 | terry.reedy | set | messages: + msg202449 |
| 2013年06月15日 19:05:08 | terry.reedy | set | versions: + Python 3.4 |
| 2012年07月10日 05:20:38 | roger.serwy | set | messages: + msg165163 |
| 2012年07月10日 05:18:46 | roger.serwy | set | messages: + msg165162 |
| 2012年07月10日 04:17:06 | terry.reedy | set | type: enhancement -> behavior messages: + msg165157 |
| 2012年07月10日 02:29:31 | roger.serwy | set | messages: + msg165145 |
| 2012年07月10日 02:27:04 | roger.serwy | create | |