[New-bugs-announce] [issue5410] msvcrt bytes cleanup

Hirokazu Yamamoto report at bugs.python.org
Tue Mar 3 12:56:15 CET 2009

New submission from Hirokazu Yamamoto <ocean-city at m2.ccsnet.ne.jp>:

I came from issue5391. Here is quote of Victor's message.

>* msvcrt.putch(char), msvcrt.ungetch(char): msvcrt has also:
>  - msvcrt.getch()->byte string of 1 byte
>  - msvcrt.getwch()->unicode string of 1 character
>  - msvcrt.putwch(unicode string of 1 character)
>  - msvcrt_ungetwch(unicode string of 1 character)
>  Hum, putch(), ungetch(), getch() use inconsistent types 
>(unicode/bytes) and should be fixed. Another issue should be open for 
>Notes: msvcrt.putwch() accepts string of length > 1 and 
>msvcrt.ungetwch() doesn't check string length (and so may crash with 
>length=0 or length > 1?).

And msvcrt.ungetwch() calls _ungetch not _ungetwch. Here is the patch
hopefully fixing these issue. (I cannot test wide version of functions
because VC6 don't have them)

components: Extension Modules, Windows
files: py3k_fix_msvcrt.patch
keywords: patch
messages: 83071
nosy: ocean-city
severity: normal
status: open
title: msvcrt bytes cleanup
versions: Python 3.1
Added file: http://bugs.python.org/file13233/py3k_fix_msvcrt.patch

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list