Commit 1d926e84 authored by Stefan Behnel's avatar Stefan Behnel

merge 0.22.x branch into master

parents 98203950 9a708007
......@@ -24,6 +24,9 @@ Bugs fixed
* 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.
......
......@@ -2572,10 +2572,26 @@ class CFuncType(CType):
return 0
if not self.same_calling_convention_as(other_type):
return 0
if self.exception_value != other_type.exception_value:
return 0
if self.exception_check != other_type.exception_check:
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
def compatible_signature_with(self, other_type, as_cmethod = 0):
......@@ -2610,11 +2626,11 @@ class CFuncType(CType):
return 0
if self.nogil != other_type.nogil:
return 0
if self.exception_value != other_type.exception_value:
return 0
if not self.exception_check and other_type.exception_check:
# a redundant exception check doesn't make functions incompatible, but a missing one does
return 0
if not self._same_exception_value(other_type.exception_value):
return 0
self.original_sig = other_type.original_sig or other_type
return 1
......@@ -2641,11 +2657,11 @@ class CFuncType(CType):
return 0
if not self.return_type.subtype_of_resolved_type(other_type.return_type):
return 0
if self.exception_value != other_type.exception_value:
return 0
if not self.exception_check and other_type.exception_check:
# a redundant exception check doesn't make functions incompatible, but a missing one does
return 0
if not self._same_exception_value(other_type.exception_value):
return 0
return 1
def same_calling_convention_as(self, other):
......
# 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')
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment