Beispiel #1
0
 def unpack_sequence(self, w_iterable, expected_length):
     w_len = op.len(w_iterable).eval(self)
     w_correct = op.eq(w_len, const(expected_length)).eval(self)
     if not self.guessbool(op.bool(w_correct).eval(self)):
         w_exc = self.exc_from_raise(const(ValueError), const(None))
         raise Raise(w_exc)
     return [op.getitem(w_iterable, const(i)).eval(self)
             for i in range(expected_length)]
Beispiel #2
0
 def unpack_sequence(self, w_iterable, expected_length):
     w_len = op.len(w_iterable).eval(self)
     w_correct = op.eq(w_len, const(expected_length)).eval(self)
     if not self.guessbool(op.bool(w_correct).eval(self)):
         w_exc = self.exc_from_raise(const(ValueError), const(None))
         raise Raise(w_exc)
     return [op.getitem(w_iterable, const(i)).eval(self)
             for i in range(expected_length)]
Beispiel #3
0
 def JUMP_IF_TRUE_OR_POP(self, target):
     w_value = self.peekvalue()
     if self.guessbool(op.bool(w_value).eval(self)):
         return target
         return target
     self.popvalue()
Beispiel #4
0
 def POP_JUMP_IF_TRUE(self, target):
     w_value = self.popvalue()
     if self.guessbool(op.bool(w_value).eval(self)):
         return target
Beispiel #5
0
 def JUMP_IF_TRUE(self, target):
     # Python <= 2.6 only
     w_cond = self.peekvalue()
     if self.guessbool(op.bool(w_cond).eval(self)):
         return target
Beispiel #6
0
 def not_(self, w_obj):
     w_bool = op.bool(w_obj).eval(self)
     return const(not self.guessbool(w_bool))
Beispiel #7
0
 def JUMP_IF_TRUE_OR_POP(self, target):
     w_value = self.peekvalue()
     if self.guessbool(op.bool(w_value).eval(self)):
         return target
         return target
     self.popvalue()
Beispiel #8
0
 def POP_JUMP_IF_TRUE(self, target):
     w_value = self.popvalue()
     if self.guessbool(op.bool(w_value).eval(self)):
         return target
Beispiel #9
0
 def JUMP_IF_TRUE(self, target):
     # Python <= 2.6 only
     w_cond = self.peekvalue()
     if self.guessbool(op.bool(w_cond).eval(self)):
         return target
Beispiel #10
0
 def not_(self, w_obj):
     w_bool = op.bool(w_obj).eval(self)
     return const(not self.guessbool(w_bool))