Skip to content

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

Closed

Description

@zooba

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

Activity

  1. self-assigned this
    on Feb 27, 2024
  2. added
    type-bugAn unexpected behavior, bug, or error
    on Feb 27, 2024
  3. zooba commented on Feb 27, 2024

    @zooba
    MemberAuthor

    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.

  4. added 2 commits that reference this issue on Feb 27, 2024
  5. added a commit that references this issue on Mar 4, 2024
  6. added a commit that references this issue on Mar 25, 2024
  7. added a commit that references this issue on Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

3.13only security fixestype-bugAn unexpected behavior, bug, or error

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions