Commit 9f9b8b4c authored by Gary Furnish's avatar Gary Furnish

Circular cdef's

parent 4c48e8d4
......@@ -329,12 +329,14 @@ class CCodeWriter:
def error_goto(self, pos):
lbl = self.error_label
self.use_label(lbl)
return "{%s = %s[%s]; %s = %s; goto %s;}" % (
return "{%s = %s[%s]; %s = %s; %s = %s; goto %s;}" % (
Naming.filename_cname,
Naming.filetable_cname,
self.lookup_filename(pos[0]),
Naming.lineno_cname,
pos[1],
Naming.clineno_cname,
Naming.line_c_macro,
lbl)
def error_goto_if(self, cond, pos):
......
......@@ -310,6 +310,7 @@ def compile(source, options = None, c_compile = 0, c_link = 0,
#------------------------------------------------------------------------
def main(command_line = 0):
args = sys.argv[1:]
any_failures = 0
if command_line:
......
This diff is collapsed.
......@@ -48,6 +48,8 @@ fileinit_cname = pyrex_prefix + "init_filenames"
intern_tab_cname = pyrex_prefix + "intern_tab"
kwds_cname = pyrex_prefix + "kwds"
lineno_cname = pyrex_prefix + "lineno"
clineno_cname = pyrex_prefix + "clineno"
cfilenm_cname = pyrex_prefix + "cfilenm"
module_cname = pyrex_prefix + "m"
moddoc_cname = pyrex_prefix + "mdoc"
methtable_cname = pyrex_prefix + "methods"
......@@ -64,6 +66,9 @@ cleanup_cname = pyrex_prefix + "module_cleanup"
optional_args_cname = pyrex_prefix + "optional_args"
no_opt_args = pyrex_prefix + "no_opt_args"
line_c_macro = "__LINE__"
file_c_macro = "__FILE__"
extern_c_macro = pyrex_prefix.upper() + "EXTERN_C"
......
......@@ -885,8 +885,8 @@ class FuncDefNode(StatNode, BlockNode):
exc_check = self.caller_will_check_exceptions()
if err_val is not None or exc_check:
code.putln(
'__Pyx_AddTraceback("%s");' %
self.entry.qualified_name)
'__Pyx_AddTraceback("%s",%s,%s);' %
(self.entry.qualified_name,Naming.cfilenm_cname,Naming.clineno_cname))
if err_val is not None:
code.putln(
"%s = %s;" % (
......@@ -3277,7 +3277,7 @@ class ExceptClauseNode(Node):
code.putln(
"/*except:*/ {")
code.putln(
'__Pyx_AddTraceback("%s");' % (self.function_name))
'__Pyx_AddTraceback("%s",%s,%s);' % (self.function_name, Naming.cfilenm_cname,Naming.clineno_cname))
# 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.
......@@ -4095,13 +4095,13 @@ static void __Pyx_WriteUnraisable(char *name) {
traceback_utility_code = [
"""
static void __Pyx_AddTraceback(char *funcname); /*proto*/
static void __Pyx_AddTraceback(char *funcname, char* cfilename, unsigned int cfileline); /*proto*/
""","""
#include "compile.h"
#include "frameobject.h"
#include "traceback.h"
static void __Pyx_AddTraceback(char *funcname) {
static void __Pyx_AddTraceback(char *funcname, char* cfilename, unsigned int cfileline) {
PyObject *py_srcfile = 0;
PyObject *py_funcname = 0;
PyObject *py_globals = 0;
......@@ -4111,7 +4111,7 @@ static void __Pyx_AddTraceback(char *funcname) {
py_srcfile = PyString_FromString(%(FILENAME)s);
if (!py_srcfile) goto bad;
py_funcname = PyString_FromString(funcname);
py_funcname = PyString_FromFormat( "%%s, %%s, %%u", funcname, cfilename, cfileline);
if (!py_funcname) goto bad;
py_globals = PyModule_GetDict(%(GLOBALS)s);
if (!py_globals) goto bad;
......
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