summaryrefslogtreecommitdiffstats
path: root/Python/compile.c
diff options
context:
space:
mode:
authorMichael W. Hudson <mwh@python.net>2002-08-30 13:09:51 (GMT)
committerMichael W. Hudson <mwh@python.net>2002-08-30 13:09:51 (GMT)
commit53d58bb369fbbc1ae93ca423f30b3beb2d83a9a1 (patch)
treed2cfada7ddfa673a343155bfbad7de1166ea3790 /Python/compile.c
parentb05e056e9f17f68daf106e1b018d1bbab2943148 (diff)
downloadcpython-53d58bb369fbbc1ae93ca423f30b3beb2d83a9a1.zip
cpython-53d58bb369fbbc1ae93ca423f30b3beb2d83a9a1.tar.gz
cpython-53d58bb369fbbc1ae93ca423f30b3beb2d83a9a1.tar.bz2
Further SET_LINENO reomval fixes. See comments in patch #587933.
Use a slightly different strategy to determine when not to call the line trace function. This removes the need for the RETURN_NONE opcode, so that's gone again. Update docs and comments to match. Thanks to Neal and Armin! Also add a test suite. This should have come with the original patch...
Diffstat (limited to 'Python/compile.c')
-rw-r--r--Python/compile.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/Python/compile.c b/Python/compile.c
index 0109fe5..26c56f4 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -4014,7 +4014,10 @@ compile_funcdef(struct compiling *c, node *n)
c->c_infunction = 1;
com_node(c, CHILD(n, 4));
c->c_infunction = 0;
- com_addbyte(c, RETURN_NONE);
+ com_addoparg(c, LOAD_CONST, com_addconst(c, Py_None));
+ com_push(c, 1);
+ com_addbyte(c, RETURN_VALUE);
+ com_pop(c, 1);
}
static void
@@ -4081,13 +4084,19 @@ compile_node(struct compiling *c, node *n)
n = CHILD(n, 0);
if (TYPE(n) != NEWLINE)
com_node(c, n);
- com_addbyte(c, RETURN_NONE);
+ com_addoparg(c, LOAD_CONST, com_addconst(c, Py_None));
+ com_push(c, 1);
+ com_addbyte(c, RETURN_VALUE);
+ com_pop(c, 1);
c->c_interactive--;
break;
case file_input: /* A whole file, or built-in function exec() */
com_file_input(c, n);
- com_addbyte(c, RETURN_NONE);
+ com_addoparg(c, LOAD_CONST, com_addconst(c, Py_None));
+ com_push(c, 1);
+ com_addbyte(c, RETURN_VALUE);
+ com_pop(c, 1);
break;
case eval_input: /* Built-in function input() */