Commit 9f6a636e by Jason Rhinelander

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.
parent 1fb9df60
...@@ -168,7 +168,9 @@ template <typename... Args> struct constructor { ...@@ -168,7 +168,9 @@ template <typename... Args> struct constructor {
auto *cl_type = get_type_info(typeid(Cpp<Class>)); auto *cl_type = get_type_info(typeid(Cpp<Class>));
cl.def("__init__", [cl_type](handle self_, Args... args) { cl.def("__init__", [cl_type](handle self_, Args... args) {
auto v_h = load_v_h(self_, cl_type); 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<Class>(v_h, new Cpp<Class>(std::forward<Args>(args)...), false); construct<Class>(v_h, new Cpp<Class>(std::forward<Args>(args)...), false);
}, extra...); }, extra...);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment