Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
gaoqiong
pybind11
Commits
00062595
Commit
00062595
authored
Jul 01, 2016
by
Wenzel Jakob
Browse files
switched internal usage of cast_error exception to reference_cast_error
parent
472ffbba
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
2 deletions
+3
-2
include/pybind11/cast.h
include/pybind11/cast.h
+1
-1
include/pybind11/common.h
include/pybind11/common.h
+1
-0
include/pybind11/pybind11.h
include/pybind11/pybind11.h
+1
-1
No files found.
include/pybind11/cast.h
View file @
00062595
...
...
@@ -254,7 +254,7 @@ public:
template
<
typename
T
>
using
cast_op_type
=
pybind11
::
detail
::
cast_op_type
<
T
>
;
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:
typedef
void
*
(
*
Constructor
)(
const
void
*
stream
);
...
...
include/pybind11/common.h
View file @
00062595
...
...
@@ -310,6 +310,7 @@ PYBIND11_RUNTIME_EXCEPTION(stop_iteration)
PYBIND11_RUNTIME_EXCEPTION
(
index_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
(
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
std
::
string
&
reason
)
{
throw
std
::
runtime_error
(
reason
);
}
...
...
include/pybind11/pybind11.h
View file @
00062595
...
...
@@ -387,7 +387,7 @@ protected:
if
((
kwargs_consumed
==
nkwargs
||
it
->
has_kwargs
)
&&
(
nargs_
==
it
->
nargs
||
it
->
has_args
))
result
=
it
->
impl
(
it
,
args_
,
kwargs
,
parent
);
}
catch
(
cast_error
&
)
{
}
catch
(
reference_
cast_error
&
)
{
result
=
PYBIND11_TRY_NEXT_OVERLOAD
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment