summaryrefslogtreecommitdiffstats
path: root/Python/_warnings.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/_warnings.c')
-rw-r--r--Python/_warnings.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/Python/_warnings.c b/Python/_warnings.c
index 9f68da2..cf2110d 100644
--- a/Python/_warnings.c
+++ b/Python/_warnings.c
@@ -854,10 +854,8 @@ setup_context(Py_ssize_t stack_level, PyObject **filename, int *lineno,
*lineno = 1;
}
else {
- globals = _PyFrame_GetGlobals(f);
- PyCodeObject *code = PyFrame_GetCode(f);
- *filename = code->co_filename;
- Py_DECREF(code);
+ globals = f->f_frame->f_globals;
+ *filename = f->f_frame->f_code->co_filename;
Py_INCREF(*filename);
*lineno = PyFrame_GetLineNumber(f);
Py_DECREF(f);