Message 342628 - Python tracker

Message342628

Author eryksun
Recipients ZackerySpytz, davin, eryksun
Date 2019-05-16.08:06:16
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1557993977.17.0.866305000678.issue36935@roundup.psfhosted.org>
In-reply-to
Content
This was my fault for recommending PyErr_SetFromWindowsErrWithUnicodeFilename without checking the header for deprecation. 

PyErr_SetFromWindowsErrWithUnicodeFilename is an internal function (added for PEP 277, circa 2.4), which was never documented in the C API. I don't follow why Serhiy deprecated it in 2016, since at the same time he updated it to use PyUnicode_FromWideChar instead of PyUnicode_FromUnicode. I see no fundamental difference in terms of resource usage between it and PyErr_SetExcFromWindowsErrWithFilename, which instead calls PyUnicode_DecodeFSDefault.

In this case, the section object (file mapping) name is useful information in the exception. If the deprecation isn't lifted, it puts the onus on us to implement this functionality -- i.e. PyUnicode_FromWideChar, PyErr_SetExcFromWindowsErrWithFilenameObjects, Py_XDECREF. Or maybe add a new PyErr_SetExcFromWindowsErrWithWideCharFilename function that takes a `const wchar_t *` string, and document it in the C API.
History
Date User Action Args
2019-05-16 08:06:17eryksunsetrecipients: + eryksun, davin, ZackerySpytz
2019-05-16 08:06:17eryksunsetmessageid: <1557993977.17.0.866305000678.issue36935@roundup.psfhosted.org>
2019-05-16 08:06:17eryksunlinkissue36935 messages
2019-05-16 08:06:16eryksuncreate