[New-bugs-announce] [issue10780] Fix filename encoding in PyErr_SetFromWindowsErrWithFilename() (and PyErr_SetExcFromWindowsErrWithFilename())

STINNER Victor report at bugs.python.org
Mon Dec 27 03:30:43 CET 2010


New submission from STINNER Victor <victor.stinner at haypocalc.com>:

PyErr_SetFromWindowsErrWithFilename() expects a filename encoded to UTF-8. It is called by win32_error() function of the nt (posix) module, and win32_error() is called on an error in the bytes implementation of a function (if the argument is a byte string, not an Unicode string). But on Windows, bytes filenames are encoded to the ANSI code page, not to UTF-8.

PyErr_SetExcFromWindowsErrWithFilename() expects also a filename encoded to UTF-8. It is not used in Python core, but I think that it should be fixed too.

See also #10779 (and #9713 and #10114).

----------
components: Interpreter Core, Unicode, Windows
messages: 124697
nosy: haypo
priority: normal
severity: normal
status: open
title: Fix filename encoding in PyErr_SetFromWindowsErrWithFilename() (and PyErr_SetExcFromWindowsErrWithFilename())
versions: Python 3.2

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10780>
_______________________________________


More information about the New-bugs-announce mailing list