Render `py::int_` as `int` in docstrings

This commit is contained in:
Sergei Izmailov 2020-05-15 00:11:39 +03:00 committed by Wenzel Jakob
parent 90d99b56a0
commit 4f1531c454
3 changed files with 5 additions and 0 deletions

View File

@ -1606,6 +1606,7 @@ template <typename base, typename deleter> struct is_holder_type<base, std::uniq
template <typename T> struct handle_type_name { static constexpr auto name = _<T>(); };
template <> struct handle_type_name<bytes> { static constexpr auto name = _(PYBIND11_BYTES_NAME); };
template <> struct handle_type_name<int_> { static constexpr auto name = _("int"); };
template <> struct handle_type_name<iterable> { static constexpr auto name = _("Iterable"); };
template <> struct handle_type_name<iterator> { static constexpr auto name = _("Iterator"); };
template <> struct handle_type_name<args> { static constexpr auto name = _("*args"); };

View File

@ -11,6 +11,8 @@
TEST_SUBMODULE(pytypes, m) {
// test_int
m.def("get_int", []{return py::int_(0);});
// test_list
m.def("get_list", []() {
py::list list;

View File

@ -5,6 +5,8 @@ import sys
from pybind11_tests import pytypes as m
from pybind11_tests import debug_enabled
def test_int(doc):
assert doc(m.get_int) == "get_int() -> int"
def test_list(capture, doc):
with capture: