Skip to content

Commit

Permalink
Unwrap back_reference in get_pytype()
Browse files Browse the repository at this point in the history
This prevents back_reference parameters from decaying to "object" in py signatures
  • Loading branch information
jvansanten authored and stefanseefeld committed Sep 17, 2024
1 parent 4c6f40f commit 0102b31
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
8 changes: 7 additions & 1 deletion include/boost/python/converter/pytype_function.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# include <boost/python/converter/registered.hpp>
# include <boost/python/detail/unwind_type.hpp>
# include <boost/python/detail/type_traits.hpp>

# include <boost/python/back_reference.hpp>

namespace boost { namespace python {

Expand Down Expand Up @@ -46,6 +46,12 @@ inline python::type_info unwind_type_id_(boost::type<T>* = 0, mpl::false_ * =0)
return boost::python::detail::unwind_type<unwind_type_id_helper, T> ();
}

template <class T>
inline python::type_info unwind_type_id_(boost::type<back_reference<T> >* = 0, mpl::false_ * =0)
{
return boost::python::detail::unwind_type<unwind_type_id_helper, T> ();
}

inline python::type_info unwind_type_id_(boost::type<void>* = 0, mpl::true_* =0)
{
return type_id<void>();
Expand Down
7 changes: 7 additions & 0 deletions test/map_indexing_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,13 @@
... i.data()
4
#####################################################################
# Test signature...
#####################################################################
>>> AMap.__iter__.__doc__.strip().split("\\n")[0]
'__iter__( (AMap)arg1) -> __main__.iterator :'
#####################################################################
# END....
#####################################################################
Expand Down

0 comments on commit 0102b31

Please sign in to comment.