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
2fa32b3c
Commit
2fa32b3c
authored
Aug 11, 2013
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Share common type object for Cython functions.
parent
367498f1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
0 deletions
+36
-0
Cython/Utility/CommonTypes.c
Cython/Utility/CommonTypes.c
+29
-0
Cython/Utility/CythonFunction.c
Cython/Utility/CythonFunction.c
+7
-0
No files found.
Cython/Utility/CommonTypes.c
0 → 100644
View file @
2fa32b3c
/////////////// FetchCommonType.proto ///////////////
static
PyTypeObject
*
__Pyx_FetchCommonType
(
PyTypeObject
*
type
);
/////////////// FetchCommonType ///////////////
static
PyTypeObject
*
__Pyx_FetchCommonType
(
PyTypeObject
*
type
)
{
static
PyObject
*
fake_module
=
NULL
;
PyTypeObject
*
cached_type
;
if
(
fake_module
==
NULL
)
{
PyObject
*
sys
=
PyImport_ImportModule
(
"sys"
);
PyObject
*
sys_modules
=
PyObject_GetAttrString
(
sys
,
"modules"
);
fake_module
=
PyDict_GetItemString
(
sys_modules
,
"_cython"
);
if
(
fake_module
==
NULL
)
{
PyObject
*
args
=
PyTuple_New
(
1
);
PyTuple_SET_ITEM
(
args
,
0
,
__Pyx_PyStr_FromString
(
"_cython"
));
fake_module
=
PyObject_Call
((
PyObject
*
)
&
PyModule_Type
,
args
,
NULL
);
PyDict_SetItemString
(
sys_modules
,
"_cython"
,
fake_module
);
}
}
if
(
PyObject_HasAttrString
(
fake_module
,
type
->
tp_name
))
{
cached_type
=
(
PyTypeObject
*
)
PyObject_GetAttrString
(
fake_module
,
type
->
tp_name
);
}
else
{
PyType_Ready
(
type
);
PyObject_SetAttrString
(
fake_module
,
type
->
tp_name
,
(
PyObject
*
)
type
);
cached_type
=
type
;
}
return
cached_type
;
}
Cython/Utility/CythonFunction.c
View file @
2fa32b3c
...
@@ -67,6 +67,7 @@ static int __Pyx_CyFunction_init(void);
...
@@ -67,6 +67,7 @@ static int __Pyx_CyFunction_init(void);
//////////////////// CythonFunction ////////////////////
//////////////////// CythonFunction ////////////////////
//@substitute: naming
//@substitute: naming
//@requires: CommonTypes.c::FetchCommonType
static
PyObject
*
static
PyObject
*
__Pyx_CyFunction_get_doc
(
__pyx_CyFunctionObject
*
op
,
CYTHON_UNUSED
void
*
closure
)
__Pyx_CyFunction_get_doc
(
__pyx_CyFunctionObject
*
op
,
CYTHON_UNUSED
void
*
closure
)
...
@@ -645,9 +646,15 @@ static int __Pyx_CyFunction_init(void) {
...
@@ -645,9 +646,15 @@ static int __Pyx_CyFunction_init(void) {
// avoid a useless level of call indirection
// avoid a useless level of call indirection
__pyx_CyFunctionType_type
.
tp_call
=
PyCFunction_Call
;
__pyx_CyFunctionType_type
.
tp_call
=
PyCFunction_Call
;
#endif
#endif
#if 1
__pyx_CyFunctionType
=
__Pyx_FetchCommonType
(
&
__pyx_CyFunctionType_type
);
if
(
__pyx_CyFunctionType
==
NULL
)
return
-
1
;
#else
if
(
PyType_Ready
(
&
__pyx_CyFunctionType_type
)
<
0
)
if
(
PyType_Ready
(
&
__pyx_CyFunctionType_type
)
<
0
)
return
-
1
;
return
-
1
;
__pyx_CyFunctionType
=
&
__pyx_CyFunctionType_type
;
__pyx_CyFunctionType
=
&
__pyx_CyFunctionType_type
;
#endif
return
0
;
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