From d1bfc4e0f8acc9f65bc7d19de5ff6ecf854ebf93 Mon Sep 17 00:00:00 2001 From: Wenzel Jakob Date: Mon, 16 May 2016 18:52:46 +0200 Subject: [PATCH] support __bool__ on Python 2.x and 3.x --- include/pybind11/pybind11.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/pybind11/pybind11.h b/include/pybind11/pybind11.h index abbf479cf..ee76a6702 100644 --- a/include/pybind11/pybind11.h +++ b/include/pybind11/pybind11.h @@ -200,6 +200,9 @@ protected: if (strcmp(rec->name, "__next__") == 0) { std::free(rec->name); rec->name = strdup("next"); + } else if (strcmp(rec->name, "__bool__") == 0) { + std::free(rec->name); + rec->name = strdup("__nonzero__"); } #endif