test_methods_and_attributes.cpp
15.8 KB
-
Don't let PyInstanceMethod hide itself · 0a90b2db
Python 3's `PyInstanceMethod_Type` hides itself via its `tp_descr_get`, which prevents aliasing methods via `cls.attr("m2") = cls.attr("m1")`: instead the `tp_descr_get` returns a plain function, when called on a class, or a `PyMethod`, when called on an instance. Override that behaviour for pybind11 types with a special bypass for `PyInstanceMethod_Types`.Jason Rhinelander committed