File tree 2 files changed +3
-0
lines changed 2 files changed +3
-0
lines changed Original file line number Diff line number Diff line change @@ -1484,6 +1484,8 @@ struct enum_base {
1484
1484
PYBIND11_ENUM_OP_CONV (" __ror__" , a | b);
1485
1485
PYBIND11_ENUM_OP_CONV (" __xor__" , a ^ b);
1486
1486
PYBIND11_ENUM_OP_CONV (" __rxor__" , a ^ b);
1487
+ m_base.attr (" __invert__" ) = cpp_function (
1488
+ [](object arg) { return ~(int_ (arg)); }, is_method (m_base));
1487
1489
}
1488
1490
} else {
1489
1491
PYBIND11_ENUM_OP_STRICT (" __eq__" , int_ (a).equal (int_ (b)), return false );
Original file line number Diff line number Diff line change @@ -140,6 +140,7 @@ def test_binary_operators():
140
140
assert int (m .Flags .Read | m .Flags .Execute ) == 5
141
141
assert int (m .Flags .Write | m .Flags .Execute ) == 3
142
142
assert int (m .Flags .Write | 1 ) == 3
143
+ assert ~ m .Flags .Write == - 3
143
144
144
145
state = m .Flags .Read | m .Flags .Write
145
146
assert (state & m .Flags .Read ) != 0
You can’t perform that action at this time.
0 commit comments