summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2001-02-09 22:55:26 (GMT)
committerJeremy Hylton <jeremy@alum.mit.edu>2001-02-09 22:55:26 (GMT)
commit6492bf71daf5ef36d32dbd0f26b302dfea0ac4b2 (patch)
tree60c22f5eebe7d14885871462e5cd38ca7068bf63 /Python
parentcb17ae8b19c35cc63e7daec871c025d903c49105 (diff)
downloadcpython-6492bf71daf5ef36d32dbd0f26b302dfea0ac4b2.zip
cpython-6492bf71daf5ef36d32dbd0f26b302dfea0ac4b2.tar.gz
cpython-6492bf71daf5ef36d32dbd0f26b302dfea0ac4b2.tar.bz2
SF patch 103589: Fix handling of cell vars that are either * or ** parameters.
(Nick Mathewson) Remove to XXX comments
Diffstat (limited to 'Python')
-rw-r--r--Python/compile.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/Python/compile.c b/Python/compile.c
index eb2ba90..8370e09 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -2486,10 +2486,6 @@ com_assert_stmt(struct compiling *c, node *n)
where <message> is the second test, if present.
*/
- /* XXX should __debug__ and AssertionError get inserted into
- the symbol table? they don't follow the normal rules
- because they are always loaded as globals */
-
if (Py_OptimizeFlag)
return;
com_addop_name(c, LOAD_GLOBAL, "__debug__");
@@ -3524,10 +3520,6 @@ com_fplist(struct compiling *c, node *n)
}
}
-/* XXX This function could probably be made simpler, because it
- doesn't do anything except generate code for complex arguments.
-*/
-
static void
com_arglist(struct compiling *c, node *n)
{
@@ -3579,12 +3571,22 @@ com_arglist(struct compiling *c, node *n)
REQ(ch, STAR);
ch = CHILD(n, i+1);
if (TYPE(ch) == NAME) {
+ PyObject *v;
i += 3;
+ v = PyDict_GetItemString(c->c_cellvars,
+ STR(ch));
+ if (v) {
+ com_addoparg(c, LOAD_FAST, narg);
+ com_addoparg(c, STORE_DEREF,
+ PyInt_AS_LONG(v));
}
+ narg++;
}
}
+ }
/* Handle **keywords */
if (i < nch) {
+ PyObject *v;
node *ch;
ch = CHILD(n, i);
if (TYPE(ch) != DOUBLESTAR) {
@@ -3596,6 +3598,11 @@ com_arglist(struct compiling *c, node *n)
else
ch = CHILD(n, i+1);
REQ(ch, NAME);
+ v = PyDict_GetItemString(c->c_cellvars, STR(ch));
+ if (v) {
+ com_addoparg(c, LOAD_FAST, narg);
+ com_addoparg(c, STORE_DEREF, PyInt_AS_LONG(v));
+ }
}
if (complex) {
/* Generate code for complex arguments only after