code.putln(" if (!__Pyx_Refnanny)")
code.putln(" Py_FatalError(\"failed to import refnanny module\");")
code.putln("}")
- code.putln("__pyx_refchk = __Pyx_Refnanny->NewContext(\"%s\", __LINE__);"% header3)
+ code.putln("__pyx_refchk = __Pyx_Refnanny->NewContext(\"%s\", __LINE__, __FILE__);"% header3)
code.putln("#endif")
code.putln("%s = PyTuple_New(0); %s" % (Naming.empty_tuple, code.error_goto_if_null(Naming.empty_tuple, self.pos)));
void (*DECREF)(void*, PyObject*, int);
void (*GOTREF)(void*, PyObject*, int);
void (*GIVEREF)(void*, PyObject*, int);
- void* (*NewContext)(const char*, int);
+ void* (*NewContext)(const char*, int, char*);
int (*FinishContext)(void**);
} __Pyx_RefnannyAPIStruct;
static __Pyx_RefnannyAPIStruct *__Pyx_Refnanny = NULL;
#define __Pyx_GIVEREF(r) __Pyx_Refnanny->GIVEREF(__pyx_refchk, (PyObject *)(r), __LINE__)
#define __Pyx_XDECREF(r) if((r) == NULL) ; else __Pyx_DECREF(r)
#define __Pyx_SetupRefcountContext(name) \
- void* __pyx_refchk = __Pyx_Refnanny->NewContext((name), __LINE__)
+ void* __pyx_refchk = __Pyx_Refnanny->NewContext((name), __LINE__, __FILE__)
#define __Pyx_FinishRefcountContext() \
__Pyx_Refnanny->FinishContext(&__pyx_refchk)
#else
pass
class Context(object):
- def __init__(self):
+ def __init__(self, name, line=0, filename=None):
+ self.name = name
+ self.start = line
+ self.filename = filename
self.refs = {} # id -> (count, [lineno])
self.errors = []
-cdef PyObject* NewContext(char* funcname, int lineno) except NULL:
+cdef PyObject* NewContext(char* funcname, int lineno, char* filename) except NULL:
cdef PyObject* type = NULL, *value = NULL, *tb = NULL
PyErr_Fetch(&type, &value, &tb)
try:
- ctx = Context()
+ ctx = Context(funcname, lineno, filename)
PyErr_Restore(<object>type, <object>value, <object>tb)
Py_INCREF(ctx)
return <PyObject*>ctx
PyErr_Fetch(&type, &value, &tb)
try:
errors = (<object>ctx[0]).end()
+ pos = (<object>ctx[0]).filename, (<object>ctx[0]).name
PyErr_Restore(<object>type, <object>value, <object>tb)
except:
Py_XDECREF(<object>type)
Py_XDECREF(<object>ctx[0])
ctx[0] = NULL
if errors:
- raise Error(errors)
+ print "%s: %s()" % pos
+ print errors # raise Error(errors)
return 0
void (*DECREF)(PyObject*, PyObject*, int)
void (*GOTREF)(PyObject*, PyObject*, int)
void (*GIVEREF)(PyObject*, PyObject*, int)
- PyObject* (*NewContext)(char*, int) except NULL
+ PyObject* (*NewContext)(char*, int, char*) except NULL
int (*FinishContext)(PyObject**) except -1
cdef RefnannyAPIStruct api