Commit ca40452b authored by Marius Wachtler's avatar Marius Wachtler

PyFrame_GetGlobals: Don't return a copy of the globals

_warnings is modifying it
parent 606f866a
......@@ -472,7 +472,8 @@ setup_context(Py_ssize_t stack_level, PyObject **filename, int *lineno,
/* Setup registry. */
assert(globals != NULL);
assert(PyDict_Check(globals));
// Pyston change: PyFrame_GetGlobals returns a attrwrapper object not a real dict
// assert(PyDict_Check(globals));
*registry = PyDict_GetItemString(globals, "__warningregistry__");
if (*registry == NULL) {
int rc;
......
......@@ -163,10 +163,7 @@ extern "C" int PyFrame_GetLineNumber(PyFrameObject* _f) noexcept {
}
extern "C" PyObject* PyFrame_GetGlobals(PyFrameObject* f) noexcept {
Box* globals = BoxedFrame::globals((Box*)f, NULL);
if (globals->cls == attrwrapper_cls)
return attrwrapperToDict(globals);
return globals;
return BoxedFrame::globals((Box*)f, NULL);
}
extern "C" PyFrameObject* PyFrame_ForStackLevel(int stack_level) noexcept {
......
import warnings
import _warnings
print "__warningregistry__" in globals()
warnings.filterwarnings('error')
try:
......@@ -12,3 +14,5 @@ try:
_warnings.warn("deperecated", Warning)
except Warning as w:
print(w.args[0])
print "__warningregistry__" in globals()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment