mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-11 08:03:55 +00:00
Changing cast_error("... Python instance was disowned.") to value_error (which changes RuntimeError to ValueError). (#2880)
This commit is contained in:
parent
01e0045547
commit
666fc0d8e8
@ -388,8 +388,8 @@ private:
|
||||
" Python instance is uninitialized.");
|
||||
}
|
||||
if (!holder().has_pointee()) {
|
||||
throw cast_error("Missing value for wrapped C++ type:"
|
||||
" Python instance was disowned.");
|
||||
throw value_error("Missing value for wrapped C++ type:"
|
||||
" Python instance was disowned.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ def test_load_with_rtrn_f(pass_f, rtrn_f, expected):
|
||||
def test_pass_unique_ptr_disowns(pass_f, rtrn_f, expected):
|
||||
obj = rtrn_f()
|
||||
assert pass_f(obj) == expected
|
||||
with pytest.raises(RuntimeError) as exc_info:
|
||||
with pytest.raises(ValueError) as exc_info:
|
||||
pass_f(obj)
|
||||
assert str(exc_info.value) == (
|
||||
"Missing value for wrapped C++ type: Python instance was disowned."
|
||||
|
@ -17,7 +17,7 @@ def test_pointee_and_ptr_owner(give_up_ownership_via):
|
||||
obj = m.pointee()
|
||||
assert obj.get_int() == 213
|
||||
owner = m.ptr_owner(obj)
|
||||
with pytest.raises(RuntimeError) as exc_info:
|
||||
with pytest.raises(ValueError) as exc_info:
|
||||
obj.get_int()
|
||||
assert (
|
||||
str(exc_info.value)
|
||||
|
Loading…
Reference in New Issue
Block a user