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
Kirill Smelkov
cython
Commits
9a708007
Commit
9a708007
authored
Feb 23, 2015
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix comparison of function signatures that use C++ exception mappings
parent
65840df6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
6 deletions
+63
-6
CHANGES.rst
CHANGES.rst
+3
-0
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+22
-6
tests/run/cpp_exception_declaration_compatibility.srctree
tests/run/cpp_exception_declaration_compatibility.srctree
+38
-0
No files found.
CHANGES.rst
View file @
9a708007
...
@@ -16,6 +16,9 @@ Bugs fixed
...
@@ -16,6 +16,9 @@ Bugs fixed
* Comparisons of (inferred) ctuples failed to compile.
* Comparisons of (inferred) ctuples failed to compile.
* C++ exception declarations with mapping functions could fail to compile when
pre-declared in .pxd files.
* C compilation could fail in pypy3.
* C compilation could fail in pypy3.
...
...
Cython/Compiler/PyrexTypes.py
View file @
9a708007
...
@@ -2572,10 +2572,26 @@ class CFuncType(CType):
...
@@ -2572,10 +2572,26 @@ class CFuncType(CType):
return
0
return
0
if
not
self
.
same_calling_convention_as
(
other_type
):
if
not
self
.
same_calling_convention_as
(
other_type
):
return
0
return
0
if
self
.
exception_value
!=
other_type
.
exception_value
:
return
0
if
self
.
exception_check
!=
other_type
.
exception_check
:
if
self
.
exception_check
!=
other_type
.
exception_check
:
return
0
return
0
if
not
self
.
_same_exception_value
(
other_type
.
exception_value
):
return
0
return
1
def
_same_exception_value
(
self
,
other_exc_value
):
if
self
.
exception_value
==
other_exc_value
:
return
1
if
self
.
exception_check
!=
'+'
:
return
0
if
not
self
.
exception_value
or
not
other_exc_value
:
return
0
if
self
.
exception_value
.
type
!=
other_exc_value
.
type
:
return
0
if
self
.
exception_value
.
entry
and
other_exc_value
.
entry
:
if
self
.
exception_value
.
entry
.
cname
!=
other_exc_value
.
entry
.
cname
:
return
0
if
self
.
exception_value
.
name
!=
other_exc_value
.
name
:
return
0
return
1
return
1
def
compatible_signature_with
(
self
,
other_type
,
as_cmethod
=
0
):
def
compatible_signature_with
(
self
,
other_type
,
as_cmethod
=
0
):
...
@@ -2610,11 +2626,11 @@ class CFuncType(CType):
...
@@ -2610,11 +2626,11 @@ class CFuncType(CType):
return
0
return
0
if
self
.
nogil
!=
other_type
.
nogil
:
if
self
.
nogil
!=
other_type
.
nogil
:
return
0
return
0
if
self
.
exception_value
!=
other_type
.
exception_value
:
return
0
if
not
self
.
exception_check
and
other_type
.
exception_check
:
if
not
self
.
exception_check
and
other_type
.
exception_check
:
# a redundant exception check doesn't make functions incompatible, but a missing one does
# a redundant exception check doesn't make functions incompatible, but a missing one does
return
0
return
0
if
not
self
.
_same_exception_value
(
other_type
.
exception_value
):
return
0
self
.
original_sig
=
other_type
.
original_sig
or
other_type
self
.
original_sig
=
other_type
.
original_sig
or
other_type
return
1
return
1
...
@@ -2641,11 +2657,11 @@ class CFuncType(CType):
...
@@ -2641,11 +2657,11 @@ class CFuncType(CType):
return
0
return
0
if
not
self
.
return_type
.
subtype_of_resolved_type
(
other_type
.
return_type
):
if
not
self
.
return_type
.
subtype_of_resolved_type
(
other_type
.
return_type
):
return
0
return
0
if
self
.
exception_value
!=
other_type
.
exception_value
:
return
0
if
not
self
.
exception_check
and
other_type
.
exception_check
:
if
not
self
.
exception_check
and
other_type
.
exception_check
:
# a redundant exception check doesn't make functions incompatible, but a missing one does
# a redundant exception check doesn't make functions incompatible, but a missing one does
return
0
return
0
if
not
self
.
_same_exception_value
(
other_type
.
exception_value
):
return
0
return
1
return
1
def
same_calling_convention_as
(
self
,
other
):
def
same_calling_convention_as
(
self
,
other
):
...
...
tests/run/cpp_exception_declaration_compatibility.srctree
0 → 100644
View file @
9a708007
# tag: cpp
"""
PYTHON setup.py build_ext -i
PYTHON test.py
"""
############### setup.py ###################
from distutils.core import setup
from Cython.Build import cythonize
setup(
name="cython_test",
ext_modules=cythonize('*.pyx', language="c++")
)
############### test.py ###################
from cpp_exc import TestClass
TestClass().test_func()
############### cpp_exc.pxd ###################
cdef inline void handle_exception():
pass
cdef class TestClass:
cpdef test_func(self) except +handle_exception
############### cpp_exc.pyx ###################
cdef class TestClass:
cpdef test_func(self) except +handle_exception:
print('test')
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