Skip to content

Don't reimplement bound methods

James Henstridge requested to merge jamesh/pygobject:bound-methods into main

While looking at how function signatures should be handled for bound methods in !341 (merged), it occurred to me that Python already had an implementation of bound methods and the inspect module knows how to build a bound method signature from its underlying function.

So I wondered whether PyGICallableInfo_Type really needed to implement the feature itself. This MR rips out the code and uses PyMethod_New() to create bound methods wrapping the underlying CallableInfo. It drops 100 lines of code, and all tests still pass. It's possible I've missed some other edge case though.

Merge request reports