mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-22 21:25:13 +00:00
cca20a7f8d
The fix for #960 could result a type being registered multiple times if its `__init__` is called multiple times. This can happen perfectly ordinarily when python-side multiple inheritance is involved: for example, with a diamond inheritance pattern with each intermediate classes invoking the parent constructor. With the change in #960, the multiple `__init__` calls meant `register_instance` was called multiple times, but the deletion only deleted it once. Thus, if a future instance of the same type was allocated at the same location, pybind would pick it up as a registered type. This fixes the issue by tracking whether a value pointer has been registered to avoid both double-registering it. (There's also a slight optimization of not needing to do a registered_instances lookup when the type is known not registered, but this is secondary). |
||
---|---|---|
.. | ||
pybind11 |