Skip to content

Commit 9f6a636

Browse files
committed
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.
1 parent 1fb9df6 commit 9f6a636

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

include/pybind11/detail/init.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,9 @@ template <typename... Args> struct constructor {
168168
auto *cl_type = get_type_info(typeid(Cpp<Class>));
169169
cl.def("__init__", [cl_type](handle self_, Args... args) {
170170
auto v_h = load_v_h(self_, cl_type);
171-
if (v_h.instance_registered()) return; // Ignore duplicate __init__ calls (see above)
171+
// If this value is already registered it must mean __init__ is invoked multiple times;
172+
// we really can't support that in C++, so just ignore the second __init__.
173+
if (v_h.instance_registered()) return;
172174

173175
construct<Class>(v_h, new Cpp<Class>(std::forward<Args>(args)...), false);
174176
}, extra...);

0 commit comments

Comments
 (0)