Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save colesbury/e3ecafad30bb291d205c7be88c7fe7d4 to your computer and use it in GitHub Desktop.

Select an option

Save colesbury/e3ecafad30bb291d205c7be88c7fe7d4 to your computer and use it in GitHub Desktop.
Doc issues remaining in Doc/c-api/threads.rst:
- Line 222: if (tstate == NULL) — the example renamed the variable to token on line 221 but the rest of the example still says tstate. Currently inconsistent and won't compile.
- Line 233: PyThreadState_Release(tstate); — same.
- Line 231: typo "calsl" → "calls".
- Line 342: typo "retreived" → "retrieved".
Doc/whatsnew/3.15.rst line 90: duplicate PEP 803 highlight still present alongside the consolidated 803/820/793 entry on lines 91-93. Not fixed.
Modules/_testcapimodule.c:3071: test_interpreter_guards is still registered as "test_interpreter_lock". Cosmetic — not fixed.
Comments on the Bug B fix
The fix returns attached_tstate as the token, and Release then does PyThreadState_Swap(attached_tstate) while that tstate is currently attached. That ends up doing a Detach + Re-Attach of the same tstate — which is
wasteful (acquires and releases the GIL / runs through stop-the-world) but correct. A cheaper variant would short-circuit the swap when to_restore == tstate, but functionally what's there now is fine.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment