GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Get the "Current" Thread State from a Thread-local · Issue #103323 · python/cpython

Get the "Current" Thread State from a Thread-local #103323

New issue
Copy link
New issue
Copy link
Closed
Closed
Get the "Current" Thread State from a Thread-local#103323
Copy link
Labels
3.12only security fixesonly security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancementA feature request or enhancement

Description

@ericsnowcurrently
ericsnowcurrently
opened on Apr 6, 2023
Issue body actions

(This is a revival of gh-84702, which @vstinner worked on several years ago.)

For a per-interpreter GIL (PEP 684) we need to start storing the "current" thread state in a thread-local variable, rather than _PyRuntime.tstate_current. There may be other benefits to the approach if we can take advantage of native compiler support (e.g. C11's __thread_local).

Also see https://discuss.python.org/t/how-to-get-the-current-thread-state/22655.

Linked PRs

  • gh-103323: Get the "Current" Thread State from a Thread-Local Variable #103324
  • gh-103323: Remove PyRuntimeState_GetThreadState() #104171
  • gh-103323: Remove current_fast_get() unused parameter #114593

Activity

  1. ericsnowcurrently
    added
    type-featureA feature request or enhancementA feature request or enhancement
    interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)
    3.12only security fixesonly security fixes
    on Apr 6, 2023
  2. ericsnowcurrently commented on Apr 6, 2023

    @ericsnowcurrently
    ericsnowcurrently
    on Apr 6, 2023
    MemberAuthor
    More actions

    CC @markshannon

  3. ericsnowcurrently
    added a commit that references this issue on Apr 24, 2023

    gh-103323: Get the "Current" Thread State from a Thread-Local Variable (

    f8abfa3
  4. carljm
    added 2 commits that reference this issue on Apr 24, 2023

    Merge branch 'main' into superopt

    19b8025

    Merge branch 'superopt' into superopt_spec

    1972ca4
  5. hauntsaninja commented on Apr 26, 2023

    @hauntsaninja
    hauntsaninja
    on Apr 26, 2023
    Contributor
    More actions

    Looks like this was completed, thanks!

    Reacted by Eric Snow
  6. hauntsaninja
    closed this as completedon Apr 26, 2023
  7. vstinner
    added 3 commits that reference this issue on May 4, 2023

    pythongh-103323: Remove PyRuntimeState_GetThreadState()

    1257ecf

    pythongh-103323: Remove PyRuntimeState_GetThreadState()

    aed221f

    gh-103323: Remove PyRuntimeState_GetThreadState() (#104171)

    45398ad
  8. vstinner
    added 2 commits that reference this issue on Jan 26, 2024

    pythongh-103323: Remove current_fast_get() unused parameter

    ddce5a1

    gh-103323: Remove current_fast_get() unused parameter (#114593)

    58f883b
  9. aisk
    added a commit that references this issue on Feb 11, 2024

    pythongh-103323: Remove current_fast_get() unused parameter (python#1…

    b81e357
  10. florianl
    added 3 commits that reference this issue on Jan 23, 2026

    python: get the Thread State from a Thread-local

    0caf197

    python: get the Thread State from a Thread-local

    4bdc15b

    python: get the Thread State from a Thread-local

    022c775
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

    3.12only security fixesonly security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancementA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.