Message165214
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). |
|
Date |
User |
Action |
Args |
2012-07-11 01:13:52 | terry.reedy | set | recipients:
+ terry.reedy, loewis, ned.deily, roger.serwy, serhiy.storchaka |
2012-07-11 01:13:52 | terry.reedy | set | messageid: <1341969232.53.0.366299555449.issue15319@psf.upfronthosting.co.za> |
2012-07-11 01:13:51 | terry.reedy | link | issue15319 messages |
2012-07-11 01:13:49 | terry.reedy | create | |
|