Skip to content

Commit 1d5b7bd

Browse files
Fix the fallback.
1 parent 3cfddbc commit 1d5b7bd

File tree

2 files changed

+22
-18
lines changed

2 files changed

+22
-18
lines changed

Objects/object.c

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2086,16 +2086,18 @@ _dir_locals(void)
20862086
if (_PyEval_GetFrame() != NULL) {
20872087
locals = _PyEval_GetFrameLocals();
20882088
}
2089-
PyThreadState *tstate = _PyThreadState_GET();
2090-
locals = _PyEval_GetGlobalsFromRunningMain(tstate);
2091-
if (locals == NULL) {
2092-
if (!_PyErr_Occurred(tstate)) {
2093-
locals = _PyEval_GetFrameLocals();
2094-
assert(_PyErr_Occurred(tstate));
2095-
}
2096-
}
20972089
else {
2098-
Py_INCREF(locals);
2090+
PyThreadState *tstate = _PyThreadState_GET();
2091+
locals = _PyEval_GetGlobalsFromRunningMain(tstate);
2092+
if (locals == NULL) {
2093+
if (!_PyErr_Occurred(tstate)) {
2094+
locals = _PyEval_GetFrameLocals();
2095+
assert(_PyErr_Occurred(tstate));
2096+
}
2097+
}
2098+
else {
2099+
Py_INCREF(locals);
2100+
}
20992101
}
21002102
if (locals == NULL) {
21012103
return NULL;

Python/bltinmodule.c

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2678,16 +2678,18 @@ builtin_vars(PyObject *self, PyObject *args)
26782678
if (_PyEval_GetFrame() != NULL) {
26792679
d = _PyEval_GetFrameLocals();
26802680
}
2681-
PyThreadState *tstate = _PyThreadState_GET();
2682-
d = _PyEval_GetGlobalsFromRunningMain(tstate);
2683-
if (d == NULL) {
2684-
if (!_PyErr_Occurred(tstate)) {
2685-
d = _PyEval_GetFrameLocals();
2686-
assert(_PyErr_Occurred(tstate));
2687-
}
2688-
}
26892681
else {
2690-
Py_INCREF(d);
2682+
PyThreadState *tstate = _PyThreadState_GET();
2683+
d = _PyEval_GetGlobalsFromRunningMain(tstate);
2684+
if (d == NULL) {
2685+
if (!_PyErr_Occurred(tstate)) {
2686+
d = _PyEval_GetFrameLocals();
2687+
assert(_PyErr_Occurred(tstate));
2688+
}
2689+
}
2690+
else {
2691+
Py_INCREF(d);
2692+
}
26912693
}
26922694
}
26932695
else {

0 commit comments

Comments
 (0)