Ejemplo n.º 1
0
 def getcode(self):
     # if the self is a compile time constant and if its code
     # is a BuiltinCode => grab and return its code as a constant
     if _is_early_constant(self):
         from pypy.interpreter.gateway import BuiltinCode
         code = hint(self, deepfreeze=True).code
         if not isinstance(code, BuiltinCode): code = self.code
     else:
         code = self.code
     return code
Ejemplo n.º 2
0
 def getcode(self):
     # if the self is a compile time constant and if its code
     # is a BuiltinCode => grab and return its code as a constant
     if _is_early_constant(self):
         from pypy.interpreter.gateway import BuiltinCode
         code = hint(self, deepfreeze=True).code
         if not isinstance(code, BuiltinCode): code = self.code
     else:
         code = self.code
     return code
Ejemplo n.º 3
0
def myint(s, start=0):
    if _is_early_constant(s):
        s = hint(s, promote=True)
        start = hint(start, promote=True)
        n = myint_internal(s, start)
        if n < 0:
            raise ValueError
    else:
        n = myint_internal(s, start)
        if n < 0:
            raise ValueError
    return n
Ejemplo n.º 4
0
def myint(s, start=0):
    if _is_early_constant(s):
        s = hint(s, promote=True)
        start = hint(start, promote=True)
        n = myint_internal(s, start)
        if n < 0:
            raise ValueError
    else:
        n = myint_internal(s, start)
        if n < 0:
            raise ValueError
    return n
Ejemplo n.º 5
0
 def f(x):
     if jit._is_early_constant(x):
         return 42
     return 0
Ejemplo n.º 6
0
 def g(x):
     if _is_early_constant(x):
         return 42
     hint(x, concrete=True)
     return 0
Ejemplo n.º 7
0
 def g(x):
     if _is_early_constant(x):
         return 42
     hint(x, concrete=True)
     return 0