aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLori A. Burns <lori.burns@gmail.com>2019-09-04 16:16:21 -0400
committerWenzel Jakob <wenzel.jakob@epfl.ch>2019-09-04 22:16:21 +0200
commitf6c4c1047a293ea77223c21f84f888e062212d78 (patch)
tree48e7d0902a5cc54f9d7c5f991698ba5b6b28ced1 /include
parent5b4751af269afab9a2e40a92b486bd29214f352b (diff)
downloadplatform_external_python_pybind11-f6c4c1047a293ea77223c21f84f888e062212d78.tar.gz
platform_external_python_pybind11-f6c4c1047a293ea77223c21f84f888e062212d78.tar.bz2
platform_external_python_pybind11-f6c4c1047a293ea77223c21f84f888e062212d78.zip
restores __invert__ to arithmetic-enabled enum, fixes #1907 (#1909)
Diffstat (limited to 'include')
-rw-r--r--include/pybind11/pybind11.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/pybind11/pybind11.h b/include/pybind11/pybind11.h
index fbd971c..a7fe189 100644
--- a/include/pybind11/pybind11.h
+++ b/include/pybind11/pybind11.h
@@ -1484,6 +1484,8 @@ struct enum_base {
PYBIND11_ENUM_OP_CONV("__ror__", a | b);
PYBIND11_ENUM_OP_CONV("__xor__", a ^ b);
PYBIND11_ENUM_OP_CONV("__rxor__", a ^ b);
+ m_base.attr("__invert__") = cpp_function(
+ [](object arg) { return ~(int_(arg)); }, is_method(m_base));
}
} else {
PYBIND11_ENUM_OP_STRICT("__eq__", int_(a).equal(int_(b)), return false);