8000 gh-106078: Move static objects related to `CONTEXTVAR` to the decimal module global state by CharlieZhao95 · Pull Request #106395 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-106078: Move static objects related to CONTEXTVAR to the decimal module global state #106395

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Jul 8, 2023
Prev Previous commit
Next Next commit
Rename state to modstate
  • Loading branch information
CharlieZhao95 committed Jul 6, 2023
commit c3e84788558cf64e8bf00e3f1fb3b05ae3362e3b
6 changes: 3 additions & 3 deletions Modules/_decimal/_decimal.c
8088
Original file line number Diff line number Diff line change
Expand Up @@ -1604,9 +1604,9 @@ static PyObject *
current_context(void)
{
PyThreadState *tstate = _PyThreadState_GET();
decimal_state *state = GLOBAL_STATE();
if (state->cached_context && state->cached_context->tstate == tstate) {
return (PyObject *)(state->cached_context);
decimal_state *modstate = GLOBAL_STATE();
if (modstate->cached_context && modstate->cached_context->tstate == tstate) {
return (PyObject *)(modstate->cached_context);
}

return current_context_from_dict();
Expand Down
0