[issue24936] Idle: handle 'raise' properly when running with subprocess (2.7)

Terry J. Reedy report at bugs.python.org
Tue Aug 25 18:41:24 CEST 2015


New submission from Terry J. Reedy:

With one process (installed 2.7.10, -n option):
>>> raise
Traceback (most recent call last):
  File "<pyshell#0>", line 2, in <module>
TypeError: exceptions must be old-style classes or derived from BaseException, not NoneType

With subprocess (default option):
>>> raise

Traceback (most recent call last):
** IDLE Internal Exception: 
  File "C:\Programs\Python27\lib\idlelib\run.py", line 325, in runcode
    exec code in self.locals
  File "C:\Programs\Python27\lib\idlelib\run.py", line 111, in main
    seq, request = rpc.request_queue.get(block=True, timeout=0.05)
  File "C:\Programs\Python27\lib\Queue.py", line 176, in get
    raise Empty
Empty

The 2.7.10 says " If no exception is active in the current scope, a TypeError exception is raised indicating that this is an error (if running under IDLE, a Queue.Empty exception is raised instead)."  The comment is not true with -n.  But adding changing 'IDLE' to 'IDLE without -n' might encourage people to think that they should use '-n'.

A workaround fix might be to add a special check to the internal error handling code to print the TypeError instead. I do not know of any other open issues about Internal Exceptions being printed.

This is a low priority issue, but it is peculiar that this seems to be the only exception so mangled. The only issue issue I found related to this section of the Idle code is #1190163.

This is a 2.7 issue only. In 3.4+, console or Idle in either mode:
>>> raise
Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    raise
RuntimeError: No active exception to reraise

----------
messages: 249137
nosy: terry.reedy
priority: low
severity: normal
stage: needs patch
status: open
title: Idle: handle 'raise' properly when running with subprocess (2.7)
type: behavior
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24936>
_______________________________________


More information about the Python-bugs-list mailing list