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.

classification
Title: 2to3: msvcrt.(get|put)ch -> (get|put)wch
Type: behavior Stage: resolved
Components: 2to3 (2.x to 3.x conversion tool) Versions: Python 3.10, Python 3.9, Python 3.8
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, eryksun, techtonik
Priority: normal Keywords:

Created on 2011-03-23 00:20 by techtonik, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (3)
msg131820 - (view) Author: anatoly techtonik (techtonik) Date: 2011-03-23 00:20
msvcrt function calls need to be renamed to unicode equivalents, because now they return bytes, which doesn't support string methods used to process the output (e.g. lower()).

http://docs.python.org/py3k/library/msvcrt.html

msvcrt.getch() -> msvcrt.getwch()
msvcrt.getche() -> msvcrt.getwche()
msvcrt.putch() -> msvcrt.putwch()
msvcrt.ungetch() -> msvcrt.ungetwch()
msg228144 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2014-10-02 00:30
The original function names are still listed and the wide versions have been added to the docs so this can be closed as "out of date".
msg379380 - (view) Author: Eryk Sun (eryksun) * (Python triager) Date: 2020-10-22 23:22
The bytes type has supported string methods for a long time now. I don't think there's anything else to do here. msvcrt.getch() is a low-level I/O function like os.read(). It should not be automatically converted to msvcrt.getwch(). Unfortunately the function names weren't changed in Python 3. I'd rather that msvcrt.getch() returned str and msvcrt.getchb() returned bytes. Then there would have actually been something for 2to3 to convert (e.g. getch -> getchb, and getwch -> getch).
History
Date User Action Args
2022-04-11 14:57:15adminsetgithub: 55855
2020-10-22 23:22:40eryksunsetstatus: open -> closed

type: behavior

nosy: + eryksun
messages: + msg379380
resolution: out of date
stage: resolved
2020-10-22 22:53:10iritkatrielsetversions: + Python 3.8, Python 3.9, Python 3.10, - Python 3.2
2019-04-26 18:19:34BreamoreBoysetnosy: - BreamoreBoy
2014-10-02 00:30:27BreamoreBoysetnosy: + BreamoreBoy
messages: + msg228144
2013-10-14 13:57:32georg.brandlsetnosy: + benjamin.peterson
2011-03-23 00:20:45techtonikcreate