Exemplo n.º 1
0
 def visit_assignment(self, lhs, rhs):
     if (isinstance(rhs, ExprNodes.IntNode)
             and isinstance(lhs, ExprNodes.NameNode)
             and Utils.long_literal(rhs.value)):
         entry = lhs.entry or self.env.lookup(lhs.name)
         if entry:
             entry.might_overflow = True
Exemplo n.º 2
0
 def visit_assignment(self, lhs, rhs):
     if (isinstance(rhs, ExprNodes.IntNode)
             and isinstance(lhs, ExprNodes.NameNode)
             and Utils.long_literal(rhs.value)):
         entry = lhs.entry or self.env.lookup(lhs.name)
         if entry:
             entry.might_overflow = True
Exemplo n.º 3
0
 def get_int_const(self, str_value, longness=False):
     longness = bool(longness or Utils.long_literal(str_value))
     try:
         c = self.int_const_index[(str_value, longness)]
     except KeyError:
         c = self.new_int_const(str_value, longness)
     return c
Exemplo n.º 4
0
 def get_int_const(self, str_value, longness=False):
     longness = bool(longness or Utils.long_literal(str_value))
     try:
         c = self.int_const_index[(str_value, longness)]
     except KeyError:
         c = self.new_int_const(str_value, longness)
     return c
Exemplo n.º 5
0
Arquivo: Code.py Projeto: dagss/cython
 def generate_int_constants(self):
     consts = [(len(c.value), c.value, c.is_long, c) for c in self.int_const_index.values()]
     consts.sort()
     decls_writer = self.parts["decls"]
     for _, value, longness, c in consts:
         cname = c.cname
         decls_writer.putln("static PyObject *%s;" % cname)
         if longness:
             function = '%s = PyLong_FromString((char *)"%s", 0, 0); %s;'
         elif Utils.long_literal(value):
             function = '%s = PyInt_FromString((char *)"%s", 0, 0); %s;'
         else:
             function = "%s = PyInt_FromLong(%s); %s;"
         init_globals = self.parts["init_globals"]
         init_globals.putln(function % (cname, value, init_globals.error_goto_if_null(cname, self.module_pos)))