mirror of
https://github.com/pybind/pybind11.git
synced 2025-01-19 17:32:37 +00:00
switched internal usage of cast_error exception to reference_cast_error
This commit is contained in:
parent
472ffbba96
commit
0006259508
@ -254,7 +254,7 @@ public:
|
|||||||
template <typename T> using cast_op_type = pybind11::detail::cast_op_type<T>;
|
template <typename T> using cast_op_type = pybind11::detail::cast_op_type<T>;
|
||||||
|
|
||||||
operator type*() { return (type *) value; }
|
operator type*() { return (type *) value; }
|
||||||
operator type&() { if (!value) throw cast_error(); return *((type *) value); }
|
operator type&() { if (!value) throw reference_cast_error(); return *((type *) value); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
typedef void *(*Constructor)(const void *stream);
|
typedef void *(*Constructor)(const void *stream);
|
||||||
|
@ -310,6 +310,7 @@ PYBIND11_RUNTIME_EXCEPTION(stop_iteration)
|
|||||||
PYBIND11_RUNTIME_EXCEPTION(index_error)
|
PYBIND11_RUNTIME_EXCEPTION(index_error)
|
||||||
PYBIND11_RUNTIME_EXCEPTION(value_error)
|
PYBIND11_RUNTIME_EXCEPTION(value_error)
|
||||||
PYBIND11_RUNTIME_EXCEPTION(cast_error) /// Thrown when pybind11::cast or handle::call fail due to a type casting error
|
PYBIND11_RUNTIME_EXCEPTION(cast_error) /// Thrown when pybind11::cast or handle::call fail due to a type casting error
|
||||||
|
PYBIND11_RUNTIME_EXCEPTION(reference_cast_error) /// Used internally
|
||||||
|
|
||||||
[[noreturn]] PYBIND11_NOINLINE inline void pybind11_fail(const char *reason) { throw std::runtime_error(reason); }
|
[[noreturn]] PYBIND11_NOINLINE inline void pybind11_fail(const char *reason) { throw std::runtime_error(reason); }
|
||||||
[[noreturn]] PYBIND11_NOINLINE inline void pybind11_fail(const std::string &reason) { throw std::runtime_error(reason); }
|
[[noreturn]] PYBIND11_NOINLINE inline void pybind11_fail(const std::string &reason) { throw std::runtime_error(reason); }
|
||||||
|
@ -387,7 +387,7 @@ protected:
|
|||||||
if ((kwargs_consumed == nkwargs || it->has_kwargs) &&
|
if ((kwargs_consumed == nkwargs || it->has_kwargs) &&
|
||||||
(nargs_ == it->nargs || it->has_args))
|
(nargs_ == it->nargs || it->has_args))
|
||||||
result = it->impl(it, args_, kwargs, parent);
|
result = it->impl(it, args_, kwargs, parent);
|
||||||
} catch (cast_error &) {
|
} catch (reference_cast_error &) {
|
||||||
result = PYBIND11_TRY_NEXT_OVERLOAD;
|
result = PYBIND11_TRY_NEXT_OVERLOAD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user