diff --git a/include/pybind11/typing.h b/include/pybind11/typing.h index 83d73bc92..b2dab0e35 100644 --- a/include/pybind11/typing.h +++ b/include/pybind11/typing.h @@ -136,7 +136,8 @@ class TypeVarObject : public object { using object::object; TypeVarObject(const char *name) { attr("__name__") = name; - attr("__bound__") = object() attr("__bound__").attr("__name__") + attr("__bound__") = object(); + attr("__bound__").attr("__name__") = pybind11::detail::make_caster::name; attr("__constraints__") = pybind11::make_tuple(); }