From 9f6a636e547fc70a02fa48436449aad67080698f Mon Sep 17 00:00:00 2001 From: Jason Rhinelander Date: Mon, 21 Aug 2017 16:50:46 -0400 Subject: [PATCH] detail/init.h: fix the "see above" comments The "see above" comment being referenced in the code comments isn't "above" anymore; copy the later factory init comment into the first constructor block to fix it. --- include/pybind11/detail/init.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/pybind11/detail/init.h b/include/pybind11/detail/init.h index ebbf9474..e98adbb2 100644 --- a/include/pybind11/detail/init.h +++ b/include/pybind11/detail/init.h @@ -168,7 +168,9 @@ template struct constructor { auto *cl_type = get_type_info(typeid(Cpp)); cl.def("__init__", [cl_type](handle self_, Args... args) { auto v_h = load_v_h(self_, cl_type); - if (v_h.instance_registered()) return; // Ignore duplicate __init__ calls (see above) + // If this value is already registered it must mean __init__ is invoked multiple times; + // we really can't support that in C++, so just ignore the second __init__. + if (v_h.instance_registered()) return; construct(v_h, new Cpp(std::forward(args)...), false); }, extra...);