Пример #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
Пример #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
Пример #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
Пример #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
Пример #5
0
 def f(x):
     if jit._is_early_constant(x):
         return 42
     return 0
Пример #6
0
 def g(x):
     if _is_early_constant(x):
         return 42
     hint(x, concrete=True)
     return 0
Пример #7
0
 def g(x):
     if _is_early_constant(x):
         return 42
     hint(x, concrete=True)
     return 0