mirror of
https://github.com/pybind/pybind11.git
synced 2026-03-14 20:27:47 +00:00
fix: throwing repr caused a segfault (#2389)
* fix: throwing repr caused a segfault * fixup! ci: include Python 3.9 RC1 (#2387)
This commit is contained in:
@@ -178,3 +178,14 @@ def test_nested_throws(capture):
|
||||
with pytest.raises(m.MyException5) as excinfo:
|
||||
m.try_catch(m.MyException, pycatch, m.MyException, m.throws5)
|
||||
assert str(excinfo.value) == "this is a helper-defined translated exception"
|
||||
|
||||
|
||||
# This can often happen if you wrap a pybind11 class in a Python wrapper
|
||||
def test_invalid_repr():
|
||||
|
||||
class MyRepr(object):
|
||||
def __repr__(self):
|
||||
raise AttributeError("Example error")
|
||||
|
||||
with pytest.raises(TypeError):
|
||||
m.simple_bool_passthrough(MyRepr())
|
||||
|
||||
Reference in New Issue
Block a user