mirror of
https://github.com/pybind/pybind11.git
synced 2026-03-14 20:27:47 +00:00
Always display python type information in cast errors (#4463)
* Always display python type information in cast errors * Address comments * Update comment
This commit is contained in:
@@ -381,3 +381,12 @@ def test_pypy_oserror_normalization():
|
||||
# https://github.com/pybind/pybind11/issues/4075
|
||||
what = m.test_pypy_oserror_normalization()
|
||||
assert "this_filename_must_not_exist" in what
|
||||
|
||||
|
||||
def test_fn_cast_int_exception():
|
||||
with pytest.raises(RuntimeError) as excinfo:
|
||||
m.test_fn_cast_int(lambda: None)
|
||||
|
||||
assert str(excinfo.value).startswith(
|
||||
"Unable to cast Python instance of type <class 'NoneType'> to C++ type"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user