Commit d6ba13d3 authored by Stefan Behnel's avatar Stefan Behnel

remove some code redundancy

parent b0c67538
...@@ -1267,15 +1267,15 @@ class GlobalState(object): ...@@ -1267,15 +1267,15 @@ class GlobalState(object):
cname = c.cname cname = c.cname
decls_writer.putln("static PyObject *%s;" % cname) decls_writer.putln("static PyObject *%s;" % cname)
if py_type == 'float': if py_type == 'float':
function = '%s = PyFloat_FromDouble(%s); %s;' function = 'PyFloat_FromDouble(%s)'
elif py_type == 'long': elif py_type == 'long':
function = '%s = PyLong_FromString((char *)"%s", 0, 0); %s;' function = 'PyLong_FromString((char *)"%s", 0, 0)'
elif Utils.long_literal(value): elif Utils.long_literal(value):
function = '%s = PyInt_FromString((char *)"%s", 0, 0); %s;' function = 'PyInt_FromString((char *)"%s", 0, 0)'
else: else:
function = "%s = PyInt_FromLong(%s); %s;" function = "PyInt_FromLong(%s)"
init_globals.putln(function % ( init_globals.putln('%s = %s; %s' % (
cname, value_code, cname, function % value_code,
init_globals.error_goto_if_null(cname, self.module_pos))) init_globals.error_goto_if_null(cname, self.module_pos)))
# The functions below are there in a transition phase only # The functions below are there in a transition phase only
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment