This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Drekin
Recipients BreamoreBoy, David.Sankel, Drekin, Jonitis, akira, amaury.forgeotdarc, christian.heimes, christoph, davidsarah, dead1ne, escapewindow, ezio.melotti, flox, giampaolo.rodola, hippietrail, lemburg, lilydjwg, mark, mhammond, ncoghlan, ned.deily, paul.moore, piotr.dobrogost, pitrou, santoso.wijaya, smerlin, ssbarnea, steve.dower, stijn, terry.reedy, tim.golden, tzot, v+python, wiz21
Date 2016-08-13.18:40:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1471113642.56.0.328240695154.issue1602@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2016-08-13 18:40:42Drekinsetrecipients: + Drekin, lemburg, mhammond, terry.reedy, paul.moore, tzot, amaury.forgeotdarc, ncoghlan, pitrou, giampaolo.rodola, christian.heimes, tim.golden, mark, ned.deily, christoph, ezio.melotti, v+python, hippietrail, ssbarnea, flox, davidsarah, santoso.wijaya, akira, BreamoreBoy, David.Sankel, smerlin, lilydjwg, piotr.dobrogost, steve.dower, wiz21, stijn, Jonitis, escapewindow, dead1ne
2016-08-13 18:40:42Drekinsetmessageid: <1471113642.56.0.328240695154.issue1602@psf.upfronthosting.co.za>
2016-08-13 18:40:42Drekinlinkissue1602 messages
2016-08-13 18:40:42Drekincreate