2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-23 05:42:30 +00:00

Handle null shared_ptrs

[SVN r18627]
This commit is contained in:
Dave Abrahams
2003-05-31 16:40:42 +00:00
parent 286f3dc093
commit f1a06b14de

View File

@@ -15,7 +15,9 @@ namespace boost { namespace python { namespace converter {
template <class T>
PyObject* shared_ptr_to_python(shared_ptr<T> const& x)
{
if (shared_ptr_deleter* d = boost::get_deleter<shared_ptr_deleter>(x))
if (!x)
return python::detail::none();
else if (shared_ptr_deleter* d = boost::get_deleter<shared_ptr_deleter>(x))
return incref(d->owner.get());
else
return converter::registered<shared_ptr<T> const&>::converters.to_python(&x);