summaryrefslogtreecommitdiffstats
path: root/Objects/frameobject.c
diff options
context:
space:
mode:
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>2008-07-21 22:00:38 (GMT)
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>2008-07-21 22:00:38 (GMT)
commite4921fec0140da8c64f9e694904a7d709de745b4 (patch)
treecbbb3c3303bc1567a09bb57cae33111f899d20b7 /Objects/frameobject.c
parent90d07171637b9f218828265bddb1c0a63f5b9403 (diff)
downloadcpython-e4921fec0140da8c64f9e694904a7d709de745b4.zip
cpython-e4921fec0140da8c64f9e694904a7d709de745b4.tar.gz
cpython-e4921fec0140da8c64f9e694904a7d709de745b4.tar.bz2
Issue2378: pdb would delete free variables when stepping into a class statement.
The problem was introduced by r53954, the correction is to restore the symmetry between PyFrame_FastToLocals and PyFrame_LocalsToFast
Diffstat (limited to 'Objects/frameobject.c')
-rw-r--r--Objects/frameobject.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/Objects/frameobject.c b/Objects/frameobject.c
index d89d72d..079c831 100644
--- a/Objects/frameobject.c
+++ b/Objects/frameobject.c
@@ -904,9 +904,12 @@ PyFrame_LocalsToFast(PyFrameObject *f, int clear)
if (ncells || nfreevars) {
dict_to_map(co->co_cellvars, ncells,
locals, fast + co->co_nlocals, 1, clear);
- dict_to_map(co->co_freevars, nfreevars,
- locals, fast + co->co_nlocals + ncells, 1,
- clear);
+ /* Same test as in PyFrame_FastToLocals() above. */
+ if (co->co_flags & CO_OPTIMIZED) {
+ dict_to_map(co->co_freevars, nfreevars,
+ locals, fast + co->co_nlocals + ncells, 1,
+ clear);
+ }
}
PyErr_Restore(error_type, error_value, error_traceback);
}