You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add the extract PyObject fields to support extending Exceptions
Any pybind11 type that extends PyExc_Exception has to have a instance
struct that contains the same initial layout. And in pybind11 currently,
the instance struct just has PyObject_HEAD. That means if you don't
change the instance struct, this will all compile, but when python seeks
into this object, it will do with the assumption that those extra fields
exist and then it will seek right off the end of viable memory and
you'll get all sorts of fun segfaults. So this change adds those extra
fields to every class_ in pybind11. It does not seem to break normal
classes to have these extra fields and it definitely seems to make
exceptions work correctly. I am not super happy about this approach, so
consider a proof of concept that should probably be improved.
0 commit comments