Skip to content

Commit 3d1ddc2

Browse files
committed
gh-161021: Fix the error code reported by winreg.ExpandEnvironmentStrings()
1 parent 2468c35 commit 3d1ddc2

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix the error code reported by :func:`winreg.ExpandEnvironmentStrings` when
2+
expanding the string fails.

‎PC/winreg.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1262,7 +1262,7 @@ winreg_ExpandEnvironmentStrings_impl(PyObject *module, const wchar_t *string)
12621262
rc = ExpandEnvironmentStringsW(string, retValue, retValueSize);
12631263
if (rc == 0) {
12641264
PyMem_Free(retValue);
1265-
return PyErr_SetFromWindowsErrWithFunction(retValueSize,
1265+
return PyErr_SetFromWindowsErrWithFunction(0,
12661266
"ExpandEnvironmentStrings");
12671267
}
12681268
o = PyUnicode_FromWideChar(retValue, -1);

0 commit comments

Comments
 (0)