Commit b6500f58 authored by Robert Bradshaw's avatar Robert Bradshaw

Fix another issue with automatic exception values.

parent c31e18c0
...@@ -2289,6 +2289,8 @@ class CppClassScope(Scope): ...@@ -2289,6 +2289,8 @@ class CppClassScope(Scope):
if entry.type.same_as(type): if entry.type.same_as(type):
# Fix with_gil vs nogil. # Fix with_gil vs nogil.
entry.type = entry.type.with_with_gil(type.with_gil) entry.type = entry.type.with_with_gil(type.with_gil)
elif type.is_cfunction and type.compatible_signature_with(entry.type):
entry.type = type
else: else:
error(pos, "Function signature does not match previous declaration") error(pos, "Function signature does not match previous declaration")
else: else:
......
...@@ -138,3 +138,30 @@ cdef cppclass MyClass[O]: ...@@ -138,3 +138,30 @@ cdef cppclass MyClass[O]:
cdef cppclass MySubclass[T](MyClass[T]): cdef cppclass MySubclass[T](MyClass[T]):
void Invoke(Callback[T]* callback): void Invoke(Callback[T]* callback):
pass pass
cdef cppclass Getter[T]:
T get(bint fire) except *:
if fire:
raise RuntimeError
else:
raise NotImplementedError
cdef cppclass GetInt(Getter[int]):
int get(bint fire) except *:
if fire:
raise RuntimeError
else:
return 389
def test_subclass_exception_values(bint fire):
"""
>>> test_subclass_exception_values(False)
389
>>> test_subclass_exception_values(True)
Traceback (most recent call last):
...
RuntimeError
"""
cdef GetInt getter
return getter.get(fire)
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