Terry J. Reedy <[email protected]> added the comment:
I agree that the _RPCFile wrapping of the stdin proxy should be undone unless
and until there is a positive reason for it -- it solves a problem -- and it is
better tested. But reversion does not solve pre-existing problems. As noted by
Roger, sys.stdin writes, which it should not do. Worse, when directly used, it
does not read, which it should do.
>>> sys.stdin
<idlelib.rpc.RPCProxy object at 0x0000000003282470>
>>> dir(sys.stdin)
['_RPCProxy__attributes', '_RPCProxy__getattributes', '_RPCProxy__getmethods',
'_RPCProxy__methods', '__class__', '__delattr__', '__dict__', '__dir__',
'__doc__', '__eq__', '__format__', '__ge__', '__getattr__', '__getattribute__',
'__gt__', '__hash__', '__init__', '__le__', '__lt__', '__module__', '__ne__',
'__new__', '__qualname__', '__reduce__', '__reduce_ex__', '__repr__',
'__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__',
'encoding', 'oid', 'sockio']
>>> sys.stdin.write('abc')
abc
>>> sys.stdin.read()
Traceback (most recent call last):
File "<pyshell#4>", line 1, in <module>
sys.stdin.read()
AttributeError: read
versus, in command interpreter (Win7,3.3.0b0)
>>> sys.stdin.read()
abcdefg
^Z
'abcdefg\n'
>>> sys.stdin.write('abc')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
io.UnsupportedOperation: not writable
Same difference for readlines and writelines. I wonder how input works if it
does not call sys.stdin.read()
I found this in rpc.py:
# XXX KBK 09Sep03 We need a proper unit test for this module.
# Previously existing test code was removed at Rev 1.27 (r34098).
----------
stage: -> needs patch
versions: +Python 3.2
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue15319>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com