Skip to content

Commit 3828a45

Browse files
committed
Fix deprecated pybind call
1 parent 890280a commit 3828a45

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/binding/python/Attributable.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ template <typename RequestedType>
275275
bool setAttributeFromObject_default(
276276
Attributable &attr, std::string const &key, py::object &obj)
277277
{
278-
if (std::string(py::str(obj.get_type())) == "<class 'list'>")
278+
if (std::string(py::str(py::type::of(obj))) == "<class 'list'>")
279279
{
280280
using ListType = std::vector<RequestedType>;
281281
return attr.setAttribute<ListType>(key, obj.cast<ListType>());
@@ -289,7 +289,7 @@ bool setAttributeFromObject_default(
289289
bool setAttributeFromObject_double(
290290
Attributable &attr, std::string const &key, py::object &obj)
291291
{
292-
if (std::string(py::str(obj.get_type())) == "<class 'list'>")
292+
if (std::string(py::str(py::type::of(obj))) == "<class 'list'>")
293293
{
294294
using ListType = std::vector<double>;
295295
using ArrayType = std::array<double, 7>;
@@ -342,7 +342,7 @@ std::optional<TargetType> tryCast(py::object const &obj)
342342
{
343343
TargetType val{};
344344
auto python_val = py::cast(std::move(val));
345-
if (!py::isinstance(obj, python_val.get_type()))
345+
if (!py::isinstance(obj, py::type::of(python_val)))
346346
{
347347
return std::nullopt;
348348
}

0 commit comments

Comments
 (0)