Terry J. Reedy added the comment:

I am presuming 2.7 has same problem since it has same code.

The patch appears to give PyShell.close a return value it did not have before. 
Perhaps remove the return?

I am slightly puzzled: self.pollinterval is 50 (millisecs). If reducing the 
wait from 100 to 1 makes the problem constant, why does reducing it to 0 make 
it go away? What have I misunderstood?

Trying to test on Windows in a 3.3 build, I get the following with or without 
the patch:

>>> exit()
Traceback (most recent call last):
  File "<pyshell#1>", line 1, in <module>
    exit()
  File "D:\Python\dev\py33\lib\site.py", line 380, in __call__
    raise SystemExit(code)
SystemExit: None
--------------------------------
def __call__(self, code=None):
            # Shells like IDLE catch the SystemExit, but listen when
            # stdin wrapper is closed.
            try:
                fd = -1
                if hasattr(sys.stdin, "fileno"):
                    fd = sys.stdin.fileno()
                if fd != 0:
                    # Don't close stdin if it wraps fd 0
                    sys.stdin.close()
            except:
                pass
            raise SystemExit(code)
>>>
---------------------------
<bare excepts are evil>
----------------------------
>>> import sys
>>> hasattr(sys.stdin, "fileno")
True
>>> sys.stdin.fileno
<built-in method fileno of PseudoInputFile object at 0x02893C08>
>>> sys.stdin.fileno()
Traceback (most recent call last):
  File "<pyshell#3>", line 1, in <module>
    sys.stdin.fileno()
io.UnsupportedOperation: fileno

The problem is that PseudoInputFile subclasses PseudoFile which now subclasses 
TestIOBase without overriding .fileno(), which raises the above. This is from 
#9290.

Bottom line: I believe quit() and exit() are broken in the current 2.7, 3.2, 
and 3.3 rc's. I will report a possible quick fix on pydev.

----------
nosy: +terry.reedy
versions: +Python 2.7, Python 3.4 -Python 3.1, Python 3.2

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue5492>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to