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
184f7edc
Commit
184f7edc
authored
Oct 19, 2014
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
do not create (potentially unused) C function coercion code when all we do is ask if it's possible
parent
afb84985
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
4 deletions
+16
-4
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+16
-4
No files found.
Cython/Compiler/PyrexTypes.py
View file @
184f7edc
...
...
@@ -2650,12 +2650,25 @@ class CFuncType(CType):
assert
not
self
.
is_fused
specialize_entry
(
entry
,
cname
)
def
c
reate_to_py_utility_code
(
self
,
env
):
#
FIXME: it seems we're trying to coerce in more cases than we should
def
c
an_coerce_to_pyobject
(
self
,
env
):
#
duplicating the decisions from create_to_py_utility_code() here avoids writing out unused code
if
self
.
has_varargs
or
self
.
optional_arg_count
:
return
False
if
self
.
to_py_function
is
not
None
:
return
self
.
to_py_function
for
arg
in
self
.
args
:
if
not
arg
.
type
.
is_pyobject
and
not
arg
.
type
.
can_coerce_to_pyobject
(
env
):
return
False
if
not
self
.
return_type
.
is_pyobject
and
not
self
.
return_type
.
can_coerce_to_pyobject
(
env
):
return
False
return
True
def
create_to_py_utility_code
(
self
,
env
):
# FIXME: it seems we're trying to coerce in more cases than we should
if
self
.
to_py_function
is
not
None
:
return
self
.
to_py_function
if
not
self
.
can_coerce_to_pyobject
(
env
):
return
False
from
.UtilityCode
import
CythonUtilityCode
import
re
safe_typename
=
re
.
sub
(
'[^a-zA-Z0-9]'
,
'__'
,
self
.
declaration_code
(
""
,
pyrex
=
1
))
...
...
@@ -2664,8 +2677,7 @@ class CFuncType(CType):
for
arg
in
self
.
args
:
if
not
arg
.
type
.
is_pyobject
and
not
arg
.
type
.
create_from_py_utility_code
(
env
):
return
False
if
not
(
self
.
return_type
.
is_pyobject
or
self
.
return_type
.
is_void
or
self
.
return_type
.
create_to_py_utility_code
(
env
)):
if
not
self
.
return_type
.
is_pyobject
and
not
self
.
return_type
.
create_to_py_utility_code
(
env
):
return
False
def
declared_type
(
ctype
):
...
...
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