Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GetLastError() not preserved across GIL operations on Windows #116012

Closed
zooba opened this issue Feb 27, 2024 · 1 comment
Closed

GetLastError() not preserved across GIL operations on Windows #116012

zooba opened this issue Feb 27, 2024 · 1 comment
Assignees
Labels
3.13 bugs and security fixes type-bug An unexpected behavior, bug, or error

Comments

@zooba
Copy link
Member

zooba commented Feb 27, 2024

Bug report

Changes to TLS usage in 3.13 may cause the last error code to be reset when ensuring, checking or releasing the GIL. We need to preserve the value.

PyGILState_Check was already updated, but the other public APIs need the same update. Potentially some of our internal/public ones too. It might just be best to add it to the PyThread_tss_* functions.

Linked PRs

@zooba zooba added the 3.13 bugs and security fixes label Feb 27, 2024
@zooba zooba self-assigned this Feb 27, 2024
@zooba zooba added the type-bug An unexpected behavior, bug, or error label Feb 27, 2024
@zooba
Copy link
Member Author

zooba commented Feb 27, 2024

Okay, I can confirm that TlsGetValue breaks convention by clearing the last error code on success, as it has no return value that uniquely indicates failure. So we just need to wrap its calls up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.13 bugs and security fixes type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant