Author: Armin Rigo <ar...@tunes.org>
Branch: py3.5-corowrapper
Changeset: r87199:10685d0bf57d
Date: 2016-09-17 22:45 +0200
http://bitbucket.org/pypy/pypy/changeset/10685d0bf57d/

Log:    translation fixes

diff --git a/pypy/interpreter/astcompiler/consts.py 
b/pypy/interpreter/astcompiler/consts.py
--- a/pypy/interpreter/astcompiler/consts.py
+++ b/pypy/interpreter/astcompiler/consts.py
@@ -10,7 +10,7 @@
 CO_GENERATOR = 0x0020
 CO_NOFREE = 0x0040
 CO_COROUTINE = 0x0080
-CO_ITERABLE_COROUTINE = 0x0100
+CO_ITERABLE_COROUTINE = 0x0100    # set by @types.coroutine
 CO_GENERATOR_ALLOWED = 0x1000
 CO_FUTURE_DIVISION = 0x2000
 CO_FUTURE_ABSOLUTE_IMPORT = 0x4000
diff --git a/pypy/interpreter/generator.py b/pypy/interpreter/generator.py
--- a/pypy/interpreter/generator.py
+++ b/pypy/interpreter/generator.py
@@ -5,6 +5,7 @@
 from pypy.interpreter.astcompiler import consts
 from rpython.rlib import jit
 from rpython.rlib.objectmodel import specialize
+from rpython.rlib.rarithmetic import r_uint
 
 
 class GeneratorOrCoroutine(W_Root):
@@ -164,7 +165,7 @@
             # We reach this point if the iterable is exhausted.
             last_instr = jit.promote(frame.last_instr)
             assert last_instr >= 0
-            return last_instr + 1
+            return r_uint(last_instr + 1)
 
         if isinstance(w_arg_or_err, SApplicationException):
             ec = space.getexecutioncontext()
@@ -178,7 +179,7 @@
                             self.KIND)
         else:
             frame.pushvalue(w_arg_or_err)
-        return last_instr + 1
+        return r_uint(last_instr + 1)
 
     def next_yield_from(self, frame, w_inputvalue_or_err):
         """Fetch the next item of the current 'yield from', push it on
@@ -205,7 +206,7 @@
             except OperationError as e:
                 if not e.match(space, space.w_AttributeError):
                     raise
-                w_value = space.w_None
+                w_stop_value = space.w_None
             frame.pushvalue(w_stop_value)
             return
         else:
@@ -227,7 +228,7 @@
             e2.record_context(space, self.frame)
             raise e2
         else:
-            space.warn(space.wrap("generator '%s' raised StopIteration"
+            space.warn(space.wrap(u"generator '%s' raised StopIteration"
                                   % self.get_qualname()),
                        space.w_PendingDeprecationWarning)
 
diff --git a/pypy/interpreter/pyframe.py b/pypy/interpreter/pyframe.py
--- a/pypy/interpreter/pyframe.py
+++ b/pypy/interpreter/pyframe.py
@@ -309,11 +309,10 @@
             try:
                 if in_generator is None:
                     assert self.last_instr == -1
-                    next_instr = 0
+                    next_instr = r_uint(0)
                 else:
                     next_instr = in_generator.resume_execute_frame(
                                                     self, w_arg_or_err)
-                next_instr = r_uint(next_instr)
                 #
                 self.dispatch(self.pycode, next_instr, executioncontext)
             except pyopcode.Return:
@@ -961,6 +960,7 @@
 
 def get_block_class(opname):
     # select the appropriate kind of block
+    from pypy.interpreter.pyopcode import block_classes
     return block_classes[opname]
 
 def unpickle_block(space, w_tup):
diff --git a/pypy/module/_continuation/interp_continuation.py 
b/pypy/module/_continuation/interp_continuation.py
--- a/pypy/module/_continuation/interp_continuation.py
+++ b/pypy/module/_continuation/interp_continuation.py
@@ -1,6 +1,7 @@
 from rpython.rlib.rstacklet import StackletThread
 from rpython.rlib import jit
 from pypy.interpreter.error import OperationError, get_cleared_operation_error
+from pypy.interpreter.error import oefmt
 from pypy.interpreter.executioncontext import ExecutionContext
 from pypy.interpreter.baseobjspace import W_Root
 from pypy.interpreter.typedef import TypeDef
@@ -115,7 +116,7 @@
         return self.space.newbool(valid)
 
     def descr__reduce__(self):
-        raise oefmt(space.w_NotImplementedError,
+        raise oefmt(self.space.w_NotImplementedError,
                     "continulet's pickle support is currently disabled")
         from pypy.module._continuation import interp_pickle
         return interp_pickle.reduce(self)
@@ -123,7 +124,7 @@
     def descr__setstate__(self, w_args):
         # XXX: review direct calls to frame.run(), notably when
         # unpickling generators (or coroutines!)
-        raise oefmt(space.w_NotImplementedError,
+        raise oefmt(self.space.w_NotImplementedError,
                     "continulet's pickle support is currently disabled")
         from pypy.module._continuation import interp_pickle
         interp_pickle.setstate(self, w_args)
diff --git a/pypy/module/_continuation/interp_pickle.py 
b/pypy/module/_continuation/interp_pickle.py
--- a/pypy/module/_continuation/interp_pickle.py
+++ b/pypy/module/_continuation/interp_pickle.py
@@ -1,6 +1,6 @@
 from pypy.tool import stdlib_opcode as pythonopcode
 from rpython.rlib import jit
-from pypy.interpreter.error import OperationError, oefmt
+from pypy.interpreter.error import OperationError
 from pypy.interpreter.pyframe import PyFrame
 from pypy.module._continuation.interp_continuation import State, global_state
 from pypy.module._continuation.interp_continuation import build_sthread
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to