bpo-39776: Lock ++interp->tstate_next_unique_id. (GH-18746) (#18746) (#18752)

- Threads created by PyGILState_Ensure() could have a duplicate tstate->id.

(cherry picked from commit b3b9ade4a3d3fe00d933bcd8fc5c5c755d1024f9)
2 files changed