File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -1503,9 +1503,11 @@ NAMESPACE_END(detail)
15031503// / Binds C++ enumerations and enumeration classes to Python
15041504template <typename Type> class enum_ : public class_<Type> {
15051505public:
1506- using class_<Type>::def;
1507- using class_<Type>::def_property_readonly;
1508- using class_<Type>::def_property_readonly_static;
1506+ using Base = class_<Type>;
1507+ using Base::def;
1508+ using Base::attr;
1509+ using Base::def_property_readonly;
1510+ using Base::def_property_readonly_static;
15091511 using Scalar = typename std::underlying_type<Type>::type;
15101512
15111513 template <typename ... Extra>
@@ -1520,7 +1522,10 @@ template <typename Type> class enum_ : public class_<Type> {
15201522 #if PY_MAJOR_VERSION < 3
15211523 def (" __long__" , [](Type value) { return (Scalar) value; });
15221524 #endif
1523- def (" __setstate__" , [](Type &value, Scalar arg) { value = static_cast <Type>(arg); });
1525+ cpp_function setstate (
1526+ [](Type &value, Scalar arg) { value = static_cast <Type>(arg); },
1527+ is_method (*this ));
1528+ attr (" __setstate__" ) = setstate;
15241529 }
15251530
15261531 // / Export enumeration entries into the parent scope
You can’t perform that action at this time.
0 commit comments