New submission from Alexander Riccio:

A minor issue (probably qualifies for the "easy" keyword):

All functions in msvcrtmodule.c (I'm looking at 
http://svn.python.org/projects/python/trunk/PC/msvcrtmodule.c) except 
msvcrt_putch and msvcrt_putwch properly check return values against error 
codes, and call one of the PyErr_Set* functions to properly bubble the error up 
the call stack.

_putch returns EOF on failure, and _putwch returns WEOF on failure.

Like the rest of the functions in that file, I imagine that the fix would 
involve something like:


if (_putch(ch) == EOF)
    return PyErr_SetFromErrno(PyExc_IOError);


Note: the Python msvcrt documentation 
(https://docs.python.org/3/library/msvcrt.html) says:

"Changed in version 3.3: Operations in this module now raise OSError where 
IOError was raised."

...so if you were to backport this minor fix, you need to consider that (not 
sure what difference that makes).

Should I take a stab at patching this myself (I've never done this for the 
Python project) or shall I leave that to the devs?

----------
components: Windows
messages: 252899
nosy: Alexander Riccio, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: msvcrt_putch/msvcrt_putwch don't check the return value of _putch/_putwch
type: behavior
versions: Python 3.6

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

Reply via email to