Skip to content

winreg.ExpandEnvironmentStrings() passes the buffer size as the error code on failure #161021

Open

Description

@aisk

cpython/PC/winreg.c

Lines 1265 to 1266 in 2468c35

return PyErr_SetFromWindowsErrWithFunction(retValueSize,
"ExpandEnvironmentStrings");

retValueSize is the required buffer size returned by the first ExpandEnvironmentStringsW() call, but it is passed as the error code here, which raises an exception with a misleading error number.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS-windowstype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions