[issue8967] Create PyErr_GetWindowsMessage() function

STINNER Victor report at bugs.python.org
Fri Jun 11 02:09:15 CEST 2010


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

PyErr_SetExcFromWindowsErrWithFilenameObject() and PyErr_SetFromErrnoWithFilenameObject() have the same code to read the localized error message. The code can be factorized in a new function PyErr_GetWindowsMessage().

About the patch:
 - free s_buf just after the call to PyUnicode_FromUnicode(), don't wait until the end of the function
 - free s_buf if s_buf is not NULL and len==0. I suppose that this case is impossible, if len==0, s_buf is set to NULL or leaved unchanged (so it's also equal to NULL)

I wrote the function to raise an UnicodeDecodeError with a Windows error message.

----------
components: Interpreter Core, Unicode, Windows
files: pyerr_getwindowsmessage.patch
keywords: patch
messages: 107505
nosy: haypo
priority: normal
severity: normal
status: open
title: Create PyErr_GetWindowsMessage() function
versions: Python 3.2
Added file: http://bugs.python.org/file17615/pyerr_getwindowsmessage.patch

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


More information about the Python-bugs-list mailing list