lbl = self.error_label
self.use_label(lbl)
if Options.c_line_in_traceback:
- cinfo = "%s = %s;" % (Naming.clineno_cname, Naming.line_c_macro)
+ cinfo = " %s = %s;" % (Naming.clineno_cname, Naming.line_c_macro)
else:
cinfo = ""
- return "{%s = %s[%s]; %s = %s; %s goto %s;}" % (
+ return "{%s = %s[%s]; %s = %s;%s goto %s;}" % (
Naming.filename_cname,
Naming.filetable_cname,
self.lookup_filename(pos[0]),
class DictNode(ExprNode):
# Dictionary constructor.
#
- # key_value_pairs [(ExprNode, ExprNode)]
+ # key_value_pairs [DictItemNode]
+
+ subexprs = ['key_value_pairs']
def compile_time_value(self, denv):
pairs = [(item.key.compile_time_value(denv), item.value.compile_time_value(denv))
from Cython.Utils import open_new_file, replace_suffix
-def recurse_vtab_check_inheritance(entry,b, dict):
+def recurse_vtab_check_inheritance(entry, b, dict):
base = entry
while base is not None:
if base.type.base_type is None or base.type.base_type.vtabstruct_cname is None:
return False
if base.type.base_type.vtabstruct_cname == b.type.vtabstruct_cname:
return True
+ if base.type.base_type.typedef_flag:
+ return True
base = dict[base.type.base_type.vtabstruct_cname]
return False
-def recurse_vtabslot_check_inheritance(entry,b, dict):
+def recurse_vtabslot_check_inheritance(entry, b, dict):
base = entry
while base is not None:
if base.type.base_type is None:
return False
if base.type.base_type.objstruct_cname == b.type.objstruct_cname:
return True
+ if base.type.base_type.typedef_flag:
+ return True
base = dict[base.type.base_type.objstruct_cname]
return False
if Options.pre_import is not None:
code.putln('static PyObject *%s;' % Naming.preimport_cname)
code.putln('static int %s;' % Naming.lineno_cname)
- code.putln('static int %s;' % Naming.clineno_cname)
+ code.putln('static int %s = 0;' % Naming.clineno_cname)
code.putln('static char * %s= %s;' % (Naming.cfilenm_cname, Naming.file_c_macro))
code.putln('static char *%s;' % Naming.filename_cname)
code.putln('static char **%s;' % Naming.filetable_cname)
scope = type.scope
vtab_dict[type.objstruct_cname]=entry
return vtab_dict
+
def generate_vtabslot_list(self, vtab_dict):
vtab_list = list()
for entry in vtab_dict.itervalues():
header = "PyMODINIT_FUNC init%s(void)" % env.module_name
code.putln("%s; /*proto*/" % header)
code.putln("%s {" % header)
- code.putln("PyObject* __pyx_internal1;")
- code.putln("PyObject* __pyx_internal2;")
+ # do we need any of these here, or just in init2?
code.put_var_declarations(env.temp_entries)
code.putln("/*--- Libary function declarations ---*/")
flat += child
else:
flat.append(child)
- self._end_pos = max([child.end_pos() for child in flat])
+ if len(flat) == 0:
+ self._end_pos = self.pos
+ else:
+ self._end_pos = max([child.end_pos() for child in flat])
return self._end_pos
"if (%s) {" %
self.match_flag)
else:
- code.putln(
- "/*except:*/ {")
- code.putln('__Pyx_AddTraceback("%s");' % self.function_name)
+ code.putln("/*except:*/ {")
+ code.putln('__Pyx_AddTraceback("%s");' % self.function_name)
# We always have to fetch the exception value even if
# there is no target, because this also normalises the
# exception and stores it in the thread state.
else:
arg_tuple = star_arg_tuple
if keyword_args:
+ keyword_args = [ExprNodes.DictItemNode(pos=key.pos, key=key, value=value)
+ for key, value in keyword_args]
keyword_dict = ExprNodes.DictNode(pos,
key_value_pairs = keyword_args)
return ExprNodes.GeneralCallNode(pos,