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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gwenaël Samain
cython
Commits
b5e77068
Commit
b5e77068
authored
Dec 08, 2013
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add some safety checks to the shared common types import
parent
0766f97f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
2 deletions
+20
-2
Cython/Utility/CommonTypes.c
Cython/Utility/CommonTypes.c
+20
-2
No files found.
Cython/Utility/CommonTypes.c
View file @
b5e77068
...
...
@@ -14,7 +14,20 @@ static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
Py_INCREF
(
fake_module
);
cached_type
=
(
PyTypeObject
*
)
PyObject_GetAttrString
(
fake_module
,
type
->
tp_name
);
if
(
!
cached_type
)
{
if
(
cached_type
)
{
if
(
!
PyType_Check
((
PyObject
*
)
cached_type
))
{
PyErr_Format
(
PyExc_TypeError
,
"Shared Cython type %.200s is not a type object"
,
type
->
tp_name
);
goto
bad
;
}
if
(
cached_type
->
tp_basicsize
!=
type
->
tp_basicsize
)
{
PyErr_Format
(
PyExc_TypeError
,
"Shared Cython type %.200s has the wrong size, try recompiling"
,
type
->
tp_name
);
goto
bad
;
}
}
else
{
if
(
!
PyErr_ExceptionMatches
(
PyExc_AttributeError
))
goto
bad
;
PyErr_Clear
();
if
(
PyType_Ready
(
type
)
<
0
)
goto
bad
;
...
...
@@ -24,8 +37,13 @@ static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
cached_type
=
type
;
}
bad
:
done
:
Py_DECREF
(
fake_module
);
// NOTE: always returns owned reference, or NULL on error
return
cached_type
;
bad:
Py_XDECREF
(
cached_type
);
cached_type
=
NULL
;
goto
done
;
}
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