Issue #15784: Modify OSError.__str__() to better distinguish between

errno error numbers and Windows error numbers.
This commit is contained in:
Richard Oudkerk 2012-08-28 19:33:26 +01:00
parent 5b9eccb383
commit ea62bd50a3
3 changed files with 7 additions and 4 deletions

View file

@ -1016,12 +1016,12 @@ OSError_str(PyOSErrorObject *self)
#ifdef MS_WINDOWS
/* If available, winerror has the priority over myerrno */
if (self->winerror && self->filename)
return PyUnicode_FromFormat("[Error %S] %S: %R",
return PyUnicode_FromFormat("[WinError %S] %S: %R",
self->winerror ? self->winerror: Py_None,
self->strerror ? self->strerror: Py_None,
self->filename);
if (self->winerror && self->strerror)
return PyUnicode_FromFormat("[Error %S] %S",
return PyUnicode_FromFormat("[WinError %S] %S",
self->winerror ? self->winerror: Py_None,
self->strerror ? self->strerror: Py_None);
#endif