Antoine Pitrou added the comment:

> • interactive console doesn't use sys.stdin for input, why?

Modules/main.c calls PyRun_AnyFileFlags(stdin, "<stdin>", ...). At this point, 
sys.stdin *is* the same as C stdin by construction, so I'm not sure how you 
came to encounter the issue.

However, it's also true that if you later redirect sys.stdin, it will be 
ignored and the original C stdin (as passed to PyRun_InteractiveLoopFlags) will 
continue to be used. On the other hand, the input() implementation has 
dedicated logic to find out whether sys.stdin is the same as C stdin.

(by the way, the issue should also apply to 2.7)

> • it uses sys.stdin.encoding, shouldn't it rather use sys.__stdin__.encoding 
> if anything?

Assuming the previous bug gets fixed, then no :-)

----------
nosy: +benjamin.peterson, brett.cannon, georg.brandl, ncoghlan
versions: +Python 2.7

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

Reply via email to