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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user