This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients Arfrever, georg.brandl, larry, python-dev, richard, serhiy.storchaka, vajrasky, vstinner
Date 2014-02-10.09:59:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1392026355.24.0.973538055594.issue20517@psf.upfronthosting.co.za>
In-reply-to
Content
Why did you add so many versions of the same functions? Only PyErr_SetExcFromWindowsErrWithFilenameObjects() and PyErr_SetFromErrnoWithFilenameObjects() are used.

The Py_UNICODE type is deprecated, you should not add new functions using it in Python 3.4.

+PyObject *PyErr_SetFromWindowsErrWithUnicodeFilenames(
+    int ierr,
+    const Py_UNICODE *filename,
+    const Py_UNICODE *filename2)

And you should avoid passing raw bytes string to build an error message, you probably has the Python object version of the filename somewhere in your code.

+PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilenames(
+    PyObject *exc,
+    /* decoded from the filesystem encoding */
+    const char *filename,
+    const char *filename2
+    );

+PyObject *PyErr_SetExcFromWindowsErrWithFilenames(
+    PyObject *exc,
+    int ierr,
+    const char *filename,
+    const char *filename2)

In Python 3.3, there are also too many functions to raise an OSError, I don't that you should so many new functions. Please remove:

- PyErr_SetFromWindowsErrWithUnicodeFilenames
- PyErr_SetFromErrnoWithFilenames
- PyErr_SetExcFromWindowsErrWithFilenames

Having two filenames in OSError is the best fix for functions like os.rename when we don't know which path raised the error. I remember that it was hard to guess if the source or the destination was the problem, so thanks for working on this.

Note: When I wrote "Unicode is really the native type", I mean a PyObject* object which is a str, not Py_UNICODE* which is deprecated.
History
Date User Action Args
2014-02-10 09:59:15vstinnersetrecipients: + vstinner, richard, georg.brandl, larry, Arfrever, python-dev, serhiy.storchaka, vajrasky
2014-02-10 09:59:15vstinnersetmessageid: <1392026355.24.0.973538055594.issue20517@psf.upfronthosting.co.za>
2014-02-10 09:59:15vstinnerlinkissue20517 messages
2014-02-10 09:59:14vstinnercreate