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
Boxiang Sun
cython
Commits
c93de3ab
Commit
c93de3ab
authored
Apr 18, 2012
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
moved __Pyx_TypeTest() utility code to ObjectHandling.c
parent
bb262b71
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
21 deletions
+19
-21
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+1
-21
Cython/Utility/ObjectHandling.c
Cython/Utility/ObjectHandling.c
+18
-0
No files found.
Cython/Compiler/ExprNodes.py
View file @
c93de3ab
...
@@ -9015,7 +9015,7 @@ class PyTypeTestNode(CoercionNode):
...
@@ -9015,7 +9015,7 @@ class PyTypeTestNode(CoercionNode):
def
generate_result_code
(
self
,
code
):
def
generate_result_code
(
self
,
code
):
if
self
.
type
.
typeobj_is_available
():
if
self
.
type
.
typeobj_is_available
():
if
not
self
.
type
.
is_builtin_type
:
if
not
self
.
type
.
is_builtin_type
:
code
.
globalstate
.
use_utility_code
(
type_test_utility_code
)
code
.
globalstate
.
use_utility_code
(
UtilityCode
.
load_cached
(
"ExtTypeTest"
,
"ObjectHandling.c"
)
)
code
.
putln
(
code
.
putln
(
"if (!(%s)) %s"
%
(
"if (!(%s)) %s"
%
(
self
.
type
.
type_test_code
(
self
.
arg
.
py_result
(),
self
.
notnone
),
self
.
type
.
type_test_code
(
self
.
arg
.
py_result
(),
self
.
notnone
),
...
@@ -9665,26 +9665,6 @@ bad:
...
@@ -9665,26 +9665,6 @@ bad:
#------------------------------------------------------------------------------------
#------------------------------------------------------------------------------------
type_test_utility_code
=
UtilityCode
(
proto
=
"""
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/
"""
,
impl
=
"""
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
if (unlikely(!type)) {
PyErr_Format(PyExc_SystemError, "Missing type object");
return 0;
}
if (likely(PyObject_TypeCheck(obj, type)))
return 1;
PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
Py_TYPE(obj)->tp_name, type->tp_name);
return 0;
}
"""
)
#------------------------------------------------------------------------------------
cpp_exception_utility_code
=
UtilityCode
(
cpp_exception_utility_code
=
UtilityCode
(
proto
=
"""
proto
=
"""
#ifndef __Pyx_CppExn2PyErr
#ifndef __Pyx_CppExn2PyErr
...
...
Cython/Utility/ObjectHandling.c
View file @
c93de3ab
...
@@ -396,3 +396,21 @@ static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObj
...
@@ -396,3 +396,21 @@ static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObj
Py_DECREF
(
margs
);
Py_DECREF
(
margs
);
return
result
;
return
result
;
}
}
/////////////// ExtTypeTest.proto ///////////////
static
CYTHON_INLINE
int
__Pyx_TypeTest
(
PyObject
*
obj
,
PyTypeObject
*
type
);
/*proto*/
/////////////// ExtTypeTest ///////////////
static
CYTHON_INLINE
int
__Pyx_TypeTest
(
PyObject
*
obj
,
PyTypeObject
*
type
)
{
if
(
unlikely
(
!
type
))
{
PyErr_Format
(
PyExc_SystemError
,
"Missing type object"
);
return
0
;
}
if
(
likely
(
PyObject_TypeCheck
(
obj
,
type
)))
return
1
;
PyErr_Format
(
PyExc_TypeError
,
"Cannot convert %.200s to %.200s"
,
Py_TYPE
(
obj
)
->
tp_name
,
type
->
tp_name
);
return
0
;
}
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