Skip to content

Commit 2475c0b

Browse files
aiskzooba
andauthored
Apply suggestions from code review
Co-authored-by: Steve Dower <[email protected]>
1 parent b8261bb commit 2475c0b

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

PC/winreg.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -988,14 +988,13 @@ winreg_CreateKeyEx_impl(PyObject *module, HKEY key, const wchar_t *sub_key,
988988
PyErr_SetFromWindowsErrWithFunction(rc, "CreateKeyEx");
989989
return NULL;
990990
}
991-
if (create_only == TRUE) {
991+
if (create_only) {
992992
if (disposition == REG_OPENED_EXISTING_KEY) {
993-
PyErr_SetString(PyExc_FileExistsError, "");
993+
PyErr_SetFromWindowsErrWithFunction(ERROR_ALREADY_EXISTS, "CreateKeyEx");
994994
if (retKey != key) {
995995
// This is not a predefined key and needs to be closed.
996996
RegCloseKey(key);
997997
}
998-
PySys_Audit("winreg.OpenKey/result", "n", NULL);
999998
return NULL;
1000999
}
10011000
}

0 commit comments

Comments
 (0)