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
54bdaf56
Commit
54bdaf56
authored
May 01, 2013
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use pre-built Python objects in __Pyx_ExportVoidPtr() utility function
parent
de696a4f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
10 deletions
+11
-10
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+3
-2
Cython/Utility/ImportExport.c
Cython/Utility/ImportExport.c
+8
-8
No files found.
Cython/Compiler/ModuleNode.py
View file @
54bdaf56
...
...
@@ -2267,8 +2267,9 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
env
.
use_utility_code
(
UtilityCode
.
load_cached
(
"VoidPtrExport"
,
"ImportExport.c"
))
for
entry
in
entries
:
signature
=
entry
.
type
.
declaration_code
(
""
)
code
.
putln
(
'if (__Pyx_ExportVoidPtr("%s", (void *)&%s, "%s") < 0) %s'
%
(
entry
.
name
,
entry
.
cname
,
signature
,
name
=
code
.
intern_identifier
(
entry
.
name
)
code
.
putln
(
'if (__Pyx_ExportVoidPtr(%s, (void *)&%s, "%s") < 0) %s'
%
(
name
,
entry
.
cname
,
signature
,
code
.
error_goto
(
self
.
pos
)))
def
generate_c_function_export_code
(
self
,
env
,
code
):
...
...
Cython/Utility/ImportExport.c
View file @
54bdaf56
...
...
@@ -387,23 +387,23 @@ bad:
/////////////// VoidPtrExport.proto ///////////////
static
int
__Pyx_ExportVoidPtr
(
const
char
*
name
,
void
*
p
,
const
char
*
sig
);
/*proto*/
static
int
__Pyx_ExportVoidPtr
(
PyObject
*
name
,
void
*
p
,
const
char
*
sig
);
/*proto*/
/////////////// VoidPtrExport ///////////////
//@substitute: naming
//@requires: ObjectHandling.c::PyObjectSetAttrStr
static
int
__Pyx_ExportVoidPtr
(
const
char
*
name
,
void
*
p
,
const
char
*
sig
)
{
PyObject
*
d
=
0
;
static
int
__Pyx_ExportVoidPtr
(
PyObject
*
name
,
void
*
p
,
const
char
*
sig
)
{
PyObject
*
d
;
PyObject
*
cobj
=
0
;
d
=
PyObject_GetAttrString
(
$
module_cname
,
(
char
*
)
"$api_name"
);
d
=
PyDict_GetItem
(
$
moddict_cname
,
PYIDENT
(
"$api_name"
));
Py_XINCREF
(
d
);
if
(
!
d
)
{
PyErr_Clear
();
d
=
PyDict_New
();
if
(
!
d
)
goto
bad
;
Py_INCREF
(
d
);
if
(
PyModule_AddObject
(
$
module_cname
,
(
char
*
)
"$api_name"
,
d
)
<
0
)
if
(
__Pyx_PyObject_SetAttrStr
(
$
module_cname
,
PYIDENT
(
"$api_name"
),
d
)
<
0
)
goto
bad
;
}
#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3 && PY_MINOR_VERSION==0)
...
...
@@ -413,7 +413,7 @@ static int __Pyx_ExportVoidPtr(const char *name, void *p, const char *sig) {
#endif
if
(
!
cobj
)
goto
bad
;
if
(
PyDict_SetItem
String
(
d
,
name
,
cobj
)
<
0
)
if
(
PyDict_SetItem
(
d
,
name
,
cobj
)
<
0
)
goto
bad
;
Py_DECREF
(
cobj
);
Py_DECREF
(
d
);
...
...
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