Skip to content

Commit

Permalink
Avoid C++17 if-init
Browse files Browse the repository at this point in the history
  • Loading branch information
dbaston committed Dec 7, 2024
1 parent 8a419de commit f9394b9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion include/pybind11_json/pybind11_json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ namespace pyjson

inline nl::json to_json(const py::handle& obj, std::set<const PyObject*>& refs)
{
if (auto ret = refs.insert(obj.ptr()); !ret.second) {
auto insert_ret = refs.insert(obj.ptr());
if (!insert_ret.second) {
throw std::runtime_error("Circular reference detected");
}

Expand Down

0 comments on commit f9394b9

Please sign in to comment.