diff options
author | Yury Selivanov <yury@magic.io> | 2018-01-23 00:11:18 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-23 00:11:18 (GMT) |
commit | f23746a934177c48eff754411aba54c31d6be2f0 (patch) | |
tree | 4b32964b53fa87701f71c71937792f2489b7bbb4 /Python/pystate.c | |
parent | 9089a265918754d95e105a7c4c409ac9352c87bb (diff) | |
download | cpython-f23746a934177c48eff754411aba54c31d6be2f0.zip cpython-f23746a934177c48eff754411aba54c31d6be2f0.tar.gz cpython-f23746a934177c48eff754411aba54c31d6be2f0.tar.bz2 |
bpo-32436: Implement PEP 567 (#5027)
Diffstat (limited to 'Python/pystate.c')
-rw-r--r-- | Python/pystate.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Python/pystate.c b/Python/pystate.c index 9c25a26..909d831 100644 --- a/Python/pystate.c +++ b/Python/pystate.c @@ -173,6 +173,8 @@ PyInterpreterState_New(void) } HEAD_UNLOCK(); + interp->tstate_next_unique_id = 0; + return interp; } @@ -313,6 +315,11 @@ new_threadstate(PyInterpreterState *interp, int init) tstate->async_gen_firstiter = NULL; tstate->async_gen_finalizer = NULL; + tstate->context = NULL; + tstate->context_ver = 1; + + tstate->id = ++interp->tstate_next_unique_id; + if (init) _PyThreadState_Init(tstate); @@ -499,6 +506,8 @@ PyThreadState_Clear(PyThreadState *tstate) Py_CLEAR(tstate->coroutine_wrapper); Py_CLEAR(tstate->async_gen_firstiter); Py_CLEAR(tstate->async_gen_finalizer); + + Py_CLEAR(tstate->context); } |