Skip to content

Commit 52ba3c7

Browse files
committed
expect_non_null optimization
[SVN r14134]
1 parent 14d2bae commit 52ba3c7

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

include/boost/python/errors.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,17 @@ inline void handle_exception()
3535
handle_exception(detail::rethrow);
3636
}
3737

38-
BOOST_PYTHON_DECL PyObject* expect_non_null_impl(PyObject* x);
38+
BOOST_PYTHON_DECL void throw_argument_error();
39+
BOOST_PYTHON_DECL void throw_error_already_set();
3940

4041
template <class T>
4142
inline T* expect_non_null(T* x)
4243
{
43-
return (T*)expect_non_null_impl((PyObject*)x);
44+
if (x == 0)
45+
throw_error_already_set();
46+
return x;
4447
}
4548

46-
BOOST_PYTHON_DECL void throw_argument_error();
47-
BOOST_PYTHON_DECL void throw_error_already_set();
48-
4949
}} // namespace boost::python
5050

5151
#endif // ERRORS_DWA052500_H_

0 commit comments

Comments
 (0)