benrg <benrud...@gmail.com> added the comment:
The REMOVE_DIR case reduces to return RemoveDirectoryW(path->wide) ? 0 : -1; so I think there's no reason to combine it with the other two. The REMOVE_BOTH case is attrs = GetFileAttributesW(path->wide); if (attrs != INVALID_FILE_ATTRIBUTES && (attrs & FILE_ATTRIBUTE_DIRECTORY)) { success = RemoveDirectoryW(path->wide); } else { success = DeleteFileW(path->wide); } return success ? 0 : -1; For REMOVE_BOTH, I don't see the need of calling GetFileAttributes - couldn't you just try DeleteFile, and if that fails, RemoveDirectory? ---------- nosy: +benrg _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue46791> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com