summaryrefslogtreecommitdiffstats
path: root/Objects/frameobject.c
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2001-05-08 04:08:59 (GMT)
committerJeremy Hylton <jeremy@alum.mit.edu>2001-05-08 04:08:59 (GMT)
commit4c889011db22df761709ac8f9bc246bf4931e9c4 (patch)
treeda5261c42a69c290aa8aed898a4d86bea5ee0760 /Objects/frameobject.c
parentd37292bb8dcdba176e0898a7a7d114ddd415379d (diff)
downloadcpython-4c889011db22df761709ac8f9bc246bf4931e9c4.zip
cpython-4c889011db22df761709ac8f9bc246bf4931e9c4.tar.gz
cpython-4c889011db22df761709ac8f9bc246bf4931e9c4.tar.bz2
SF patch 419176 from MvL; fixed bug 418977
Two errors in dict_to_map() helper used by PyFrame_LocalsToFast().
Diffstat (limited to 'Objects/frameobject.c')
-rw-r--r--Objects/frameobject.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/Objects/frameobject.c b/Objects/frameobject.c
index 8e78f0f..6e66d23 100644
--- a/Objects/frameobject.c
+++ b/Objects/frameobject.c
@@ -283,12 +283,9 @@ dict_to_map(PyObject *map, int nmap, PyObject *dict, PyObject **values,
PyObject *value = PyDict_GetItem(dict, key);
Py_XINCREF(value);
if (deref) {
- if (value) {
+ if (value || clear) {
if (PyCell_Set(values[j], value) < 0)
PyErr_Clear();
- } else if (clear) {
- Py_XDECREF(values[j]);
- values[j] = value;
}
} else if (value != NULL || clear) {
Py_XDECREF(values[j]);
@@ -370,10 +367,10 @@ PyFrame_LocalsToFast(PyFrameObject *f, int clear)
return;
dict_to_map(f->f_code->co_cellvars,
PyTuple_GET_SIZE(f->f_code->co_cellvars),
- locals, fast, 1, clear);
+ locals, fast + f->f_nlocals, 1, clear);
dict_to_map(f->f_code->co_freevars,
PyTuple_GET_SIZE(f->f_code->co_freevars),
- locals, fast, 1, clear);
+ locals, fast + f->f_nlocals + f->f_ncells, 1, clear);
}
PyErr_Restore(error_type, error_value, error_traceback);
}