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
da8a17c9
Commit
da8a17c9
authored
May 24, 2008
by
Gregory Ewing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix nogil function pointer assignment rules
parent
9bac9c2e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
8 deletions
+20
-8
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+20
-8
No files found.
Cython/Compiler/PyrexTypes.py
View file @
da8a17c9
...
...
@@ -606,14 +606,18 @@ class CPtrType(CType):
def
assignable_from_resolved_type
(
self
,
other_type
):
if
other_type
is
error_type
:
return
1
el
if
other_type
.
is_null_ptr
:
if
other_type
.
is_null_ptr
:
return
1
elif
self
.
base_type
.
is_cfunction
and
other_type
.
is_cfunction
:
return
self
.
base_type
.
same_as
(
other_type
)
elif
other_type
.
is_array
or
other_type
.
is_ptr
:
if
self
.
base_type
.
is_cfunction
:
if
other_type
.
is_ptr
:
other_type
=
other_type
.
base_type
.
resolve
()
if
other_type
.
is_cfunction
:
return
self
.
base_type
.
pointer_assignable_from_resolved_type
(
other_type
)
else
:
return
0
if
other_type
.
is_array
or
other_type
.
is_ptr
:
return
self
.
base_type
.
is_void
or
self
.
base_type
.
same_as
(
other_type
.
base_type
)
else
:
return
0
return
0
class
CNullPtrType
(
CPtrType
):
...
...
@@ -668,7 +672,7 @@ class CFuncType(CType):
return
self
.
same_c_signature_as_resolved_type
(
other_type
.
resolve
(),
as_cmethod
)
def
same_c_signature_as_resolved_type
(
self
,
other_type
,
as_cmethod
):
def
same_c_signature_as_resolved_type
(
self
,
other_type
,
as_cmethod
=
0
):
#print "CFuncType.same_c_signature_as_resolved_type:", \
# self, other_type, "as_cmethod =", as_cmethod ###
if
other_type
is
error_type
:
...
...
@@ -775,7 +779,13 @@ class CFuncType(CType):
def
same_as_resolved_type
(
self
,
other_type
,
as_cmethod
=
0
):
return
self
.
same_c_signature_as_resolved_type
(
other_type
,
as_cmethod
)
\
and
self
.
same_exception_signature_as_resolved_type
(
other_type
)
and
self
.
same_exception_signature_as_resolved_type
(
other_type
)
\
and
self
.
nogil
==
other_type
.
nogil
def
pointer_assignable_from_resolved_type
(
self
,
other_type
):
return
self
.
same_c_signature_as_resolved_type
(
other_type
)
\
and
self
.
same_exception_signature_as_resolved_type
(
other_type
)
\
and
not
(
self
.
nogil
and
not
other_type
.
nogil
)
def
declaration_code
(
self
,
entity_code
,
for_display
=
0
,
dll_linkage
=
None
,
pyrex
=
0
):
...
...
@@ -806,6 +816,8 @@ class CFuncType(CType):
if
(
not
entity_code
and
cc
)
or
entity_code
.
startswith
(
"*"
):
entity_code
=
"(%s%s)"
%
(
cc
,
entity_code
)
cc
=
""
if
not
entity_code
:
entity_code
=
"()"
return
self
.
return_type
.
declaration_code
(
"%s%s(%s)%s"
%
(
cc
,
entity_code
,
arg_decl_code
,
trailer
),
for_display
,
dll_linkage
,
pyrex
)
...
...
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