Adam Bartoš added the comment:

Hello Steve, that's great you are working on this!

I've ran through your patch and I have the following remarks:

• Since wide chars have two bytes, there may be problem when someone wants to 
read or write odd number of bytes. If the number is > 1, it's ok since the code 
may read or write less bytes, but when the number is exactly 1, the code should 
maybe raise some exception.

• WriteConsoleW always fails with ERROR_NOT_ENOUGH_MEMORY (8) if we try to 
write more than a certain number of bytes. For me, the number is something like 
41000. Unfortunately, it depends on actual heap usage of the console process. I 
do len = min(len, 32767) in write. The the value chosen comes from issue11395 .

• If someone types something like ^Zfoo, the standard sys.stdin returns '' -- 
it ignores everything after EOF if it is the first byte read. I reproduce the 
bahaviour in win_unicode_console to be compatible.

• There may be some issue when someone hits Ctrl-C on input. It seems that in 
that case, ReadConsoleW fails with ERROR_OPERATION_ABORTED (995) and some 
signal is asynchronously fired. It may happen that the corresponding 
KeyboardInterrupt exception occurs later that it should. In my Python/ctypes 
situation I do an ugly hack – I detect ERROR_OPERATION_ABORTED and in that case 
I sleep for 0.1 seconds to wait for the exception. I understand that the 
situation may me different in C.

----------

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

Reply via email to