Message 275003 - Python tracker (original) (raw)
+++ b/Lib/test/test_winconsoleio.py +to real people with real keyborads. Should be keyboards There are still assert_() calls in this file (1602_6.patch). Did you miss them?
+++ b/Lib/io.py +from _io import WindowsConsoleIO +all.append('WindowsConsoleIO') I think you should either document this class, or remove it from all to clarify it is just an implementation detail.
+++ b/Modules/_io/winconsoleio.c +_io_WindowsConsoleIO___init___impl
- PyObject *decodedname = Py_None;
- Py_INCREF(decodedname);
- int d = PyUnicode_FSDecoder(nameobj, (void*)&decodedname);
Won’t this leak a reference to Py_None? (Also, I think needless casting like in the last line can mask mistakes that the compiler would otherwise pick up. Imagine if you got the parameters around the wrong way.)
+read_console_w(HANDLE handle, DWORD maxlen, DWORD *readlen) {
- /* If we didn't read a full buffer that time, don't try
again or we will block a second time. */
I’m not familiar with the Windows APIs involved, but this doesn’t seem robust. What if there were exactly one full buffer waiting, would the next call block without returning anything?