Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Rename fdata->f_globals to fdata->globals
  • Loading branch information
ncoghlan committed Mar 19, 2022
commit c878951bdb58e6398450ab4737ce81f314bb632c
4 changes: 2 additions & 2 deletions Include/internal/pycore_frame.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ typedef signed char PyFrameState;

typedef struct _Py_frame {
PyFunctionObject *func; /* Strong reference */
PyObject *f_globals; /* Borrowed reference */
PyObject *globals; /* Borrowed reference */
PyObject *f_builtins; /* Borrowed reference */
PyObject *f_locals; /* Strong reference, may be NULL */
PyCodeObject *f_code; /* Strong reference */
Expand Down Expand Up @@ -155,7 +155,7 @@ _PyFrame_InitializeSpecials(
frame->func = func;
frame->f_code = (PyCodeObject *)Py_NewRef(func->func_code);
frame->f_builtins = func->func_builtins;
frame->f_globals = func->func_globals;
frame->globals = func->func_globals;
frame->f_locals = Py_XNewRef(locals);
frame->stacktop = nlocalsplus;
frame->frame_obj = NULL;
Expand Down
2 changes: 1 addition & 1 deletion Objects/frameobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ frame_getlasti(PyFrameObject *f, void *closure)
static PyObject *
frame_getglobals(PyFrameObject *f, void *closure)
{
PyObject *globals = f->f_frame->f_globals;
PyObject *globals = f->f_frame->globals;
if (globals == NULL) {
globals = Py_None;
}
Expand Down
2 changes: 1 addition & 1 deletion Python/_warnings.c
Original file line number Diff line number Diff line change
Expand Up @@ -848,7 +848,7 @@ setup_context(Py_ssize_t stack_level, PyObject **filename, int *lineno,
*lineno = 1;
}
else {
globals = f->f_frame->f_globals;
globals = f->f_frame->globals;
*filename = f->f_frame->f_code->co_filename;
Py_INCREF(*filename);
*lineno = PyFrame_GetLineNumber(f);
Expand Down
8 changes: 4 additions & 4 deletions Python/ceval.c
Original file line number Diff line number Diff line change
Expand Up @@ -1441,7 +1441,7 @@ eval_frame_handle_pending(PyThreadState *tstate)
#define UPDATE_PREV_INSTR_OPARG(instr, oparg) ((uint8_t*)(instr))[-1] = (oparg)


#define GLOBALS() frame->f_globals
#define GLOBALS() frame->globals
#define BUILTINS() frame->f_builtins
#define LOCALS() frame->f_locals

Expand Down Expand Up @@ -6994,7 +6994,7 @@ PyEval_GetGlobals(void)
if (current_frame == NULL) {
return NULL;
}
return current_frame->f_globals;
return current_frame->globals;
}

int
Expand Down Expand Up @@ -7221,7 +7221,7 @@ import_name(PyThreadState *tstate, _Py_frame *frame,
}
res = PyImport_ImportModuleLevelObject(
name,
frame->f_globals,
frame->globals,
locals == NULL ? Py_None :locals,
fromlist,
ilevel);
Expand All @@ -7231,7 +7231,7 @@ import_name(PyThreadState *tstate, _Py_frame *frame,
Py_INCREF(import_func);

stack[0] = name;
stack[1] = frame->f_globals;
stack[1] = frame->globals;
stack[2] = locals == NULL ? Py_None : locals;
stack[3] = fromlist;
stack[4] = level;
Expand Down
2 changes: 1 addition & 1 deletion Python/suggestions.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ offer_suggestions_for_name_error(PyNameErrorObject *exc)
return suggestions;
}

dir = PySequence_List(frame->f_frame->f_globals);
dir = PySequence_List(frame->f_frame->globals);
if (dir == NULL) {
return NULL;
}
Expand Down
2 changes: 1 addition & 1 deletion Tools/gdb/libpython.py
Original file line number Diff line number Diff line change
Expand Up @@ -1003,7 +1003,7 @@ def _f_special(self, name, convert=PyObjectPtr.from_pyobject_ptr):
return convert(self._gdbval[name])

def _f_globals(self):
return self._f_special("f_globals")
return self._f_special("globals")

def _f_builtins(self):
return self._f_special("f_builtins")
Expand Down