PEP 788: Reimagining Native Threads (new updates)

I’ve made several changes to PEP 788 based on the initial round of discussion. Most importantly:

  • Strong and weak interpreter references are now their own type instead of being implicitly held in interpreter pointers and IDs.
  • Interpreter references are now a property of an interpreter, rather than a property of a thread. This means there’s no more “non-daemon thread states”.

Get it while it’s hot:

6 Likes

I prefer this new API :+1:.

Holding a strong interpreter reference is a visible way to prevent the interpreter shutdown: the shutdown cannot occur before PyInterpreterRef_Close().

I also like that PyThreadState_Ensure() doesn’t consume a strong interpreter reference.

2 Likes