Skip to content

Commit 11b229c

Browse files
committed
Fix error handling
1 parent 823d0dd commit 11b229c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Modules/getpath.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -525,9 +525,9 @@ getpath_realpath(PyObject *Py_UNUSED(self) , PyObject *args)
525525
Py_END_ALLOW_THREADS
526526

527527
if (err) {
528-
return PyErr_SetFromWindowsErr(GetLastError());
529-
}
530-
if (len <= MAXPATHLEN) {
528+
PyErr_SetFromWindowsErr(err);
529+
result = NULL;
530+
} else if (len <= MAXPATHLEN) {
531531
const wchar_t *p = resolved;
532532
if (0 == wcsncmp(p, L"\\\\?\\", 4)) {
533533
if (GetFileAttributesW(&p[4]) != INVALID_FILE_ATTRIBUTES) {

0 commit comments

Comments
 (0)