Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
85d7fe69
Commit
85d7fe69
authored
Feb 20, 2009
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Print refnanny errors rather than raise them.
parent
27f4b996
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
8 deletions
+13
-8
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+3
-3
Cython/Runtime/refnanny.pyx
Cython/Runtime/refnanny.pyx
+10
-5
No files found.
Cython/Compiler/ModuleNode.py
View file @
85d7fe69
...
...
@@ -1594,7 +1594,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
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
)));
...
...
@@ -2338,7 +2338,7 @@ typedef struct {
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;
...
...
@@ -2350,7 +2350,7 @@ 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
...
...
Cython/Runtime/refnanny.pyx
View file @
85d7fe69
...
...
@@ -15,7 +15,10 @@ class Error(Exception):
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
=
[]
...
...
@@ -57,11 +60,11 @@ class Context(object):
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
...
...
@@ -120,6 +123,7 @@ cdef int FinishContext(PyObject** ctx) except -1:
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
)
...
...
@@ -130,7 +134,8 @@ cdef int FinishContext(PyObject** ctx) except -1:
Py_XDECREF
(
<
object
>
ctx
[
0
])
ctx
[
0
]
=
NULL
if
errors
:
raise
Error
(
errors
)
print
"%s: %s()"
%
pos
print
errors
# raise Error(errors)
return
0
...
...
@@ -144,7 +149,7 @@ ctypedef struct RefnannyAPIStruct:
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment