Files
pybind11/include
Ralf W. Grosse-Kunstleve cf5958d516 Streamline implementation and avoid unsafe reinterpret_cast<instance *>() introduced with PR #2152
The `reinterpret_cast<instance *>(self)` is unsafe if `__new__` is mocked,
which was actually found in the wild: the mock returned `None` for `self`.
This was inconsequential because `inst` is currently cast straight back to
`PyObject *` to compute `all_type_info()`, which is empty if `self` is not
a pybind11 `instance`, and then `inst` is never dereferenced. However, the
unsafe detour through `instance *` is easily avoided and the updated
implementation is less prone to accidents while debugging or refactoring.
2023-07-30 23:41:43 -07:00
..