Author: Dario Bertini <berda...@gmail.com> Branch: Changeset: r45114:f966c0c8d357 Date: 2011-06-25 17:12 +0200 http://bitbucket.org/pypy/pypy/changeset/f966c0c8d357/
Log: (berdario, armin, enrico franchi) Generate the same SET_ADD and MAP_ADD opcode as CPython (and thus also as the compiler module) thus fixing related segfaults in test_compiler diff --git a/pypy/interpreter/astcompiler/codegen.py b/pypy/interpreter/astcompiler/codegen.py --- a/pypy/interpreter/astcompiler/codegen.py +++ b/pypy/interpreter/astcompiler/codegen.py @@ -134,7 +134,7 @@ def accept_comp_iteration(self, codegen, index): self.elt.walkabout(codegen) - codegen.emit_op_arg(ops.SET_ADD, index) + codegen.emit_op_arg(ops.SET_ADD, index + 1) class __extend__(ast.DictComp): @@ -148,7 +148,7 @@ def accept_comp_iteration(self, codegen, index): self.value.walkabout(codegen) self.key.walkabout(codegen) - codegen.emit_op_arg(ops.MAP_ADD, index) + codegen.emit_op_arg(ops.MAP_ADD, index + 1) # These are frame blocks. diff --git a/pypy/interpreter/pyopcode.py b/pypy/interpreter/pyopcode.py --- a/pypy/interpreter/pyopcode.py +++ b/pypy/interpreter/pyopcode.py @@ -1048,13 +1048,13 @@ def SET_ADD(self, oparg, next_instr): w_value = self.popvalue() - w_set = self.peekvalue(oparg) + w_set = self.peekvalue(oparg - 1) self.space.call_method(w_set, 'add', w_value) def MAP_ADD(self, oparg, next_instr): w_key = self.popvalue() w_value = self.popvalue() - w_dict = self.peekvalue(oparg) + w_dict = self.peekvalue(oparg - 1) self.space.setitem(w_dict, w_key, w_value) def SET_LINENO(self, lineno, next_instr): _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit