mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-22 21:25:13 +00:00
fix crash when None is passed to enum::operator==
This commit is contained in:
parent
9059bd8134
commit
6fb48490ef
@ -409,7 +409,6 @@ protected:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (kwargs_consumed == nkwargs)
|
if (kwargs_consumed == nkwargs)
|
||||||
result = it->impl(it, args_, parent);
|
result = it->impl(it, args_, parent);
|
||||||
|
|
||||||
@ -938,9 +937,10 @@ public:
|
|||||||
: std::string(it->second));
|
: std::string(it->second));
|
||||||
});
|
});
|
||||||
this->def("__init__", [](Type& value, int i) { value = (Type)i; });
|
this->def("__init__", [](Type& value, int i) { value = (Type)i; });
|
||||||
|
this->def("__init__", [](Type& value, int i) { new (&value) Type((Type) i); });
|
||||||
this->def("__int__", [](Type value) { return (int) value; });
|
this->def("__int__", [](Type value) { return (int) value; });
|
||||||
this->def("__eq__", [](const Type &value, Type value2) { return value == value2; });
|
this->def("__eq__", [](const Type &value, Type *value2) { return value2 && value == *value2; });
|
||||||
this->def("__ne__", [](const Type &value, Type value2) { return value != value2; });
|
this->def("__ne__", [](const Type &value, Type *value2) { return !value2 || value != *value2; });
|
||||||
this->def("__hash__", [](const Type &value) { return (int) value; });
|
this->def("__hash__", [](const Type &value) { return (int) value; });
|
||||||
m_entries = entries;
|
m_entries = entries;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user