Currently, some caveats arise from the absence of __get__ on the type of functions written in C extension modules. See the following snippet:
def prnt(*a, **k): print(*a, **k)
class A:
func = print
class B:
func = prnt
A.func('A')
A().func('A()')
B.func('B')
B().func('B()')
Output:
A
A()
B
<__main__.B object at 0x00000277F0377A10> B()
Would it be beneficial to implement a dummy __get__ on builtin_function_or_method which always raises, say, TypeError, to flag mistakes like this or force the user to more idiomatically use @staticmethod if it was intended?
Will an extremely long deprecation period work? That is, provisionally implementing __get__ as an identity method which emits DeprecationWarning saying that __get__ will return a method in the future?
Test it locally first. If there is too much breakage, you will abandon the idea yourself. If the impact is minimal and easily fixed, this is discussable.
Since I’m unfamiliar with the C logic, I would like some guidance. Am I to implement meth_descr_get in Objects/methodobject.c that calls PyErr_WarnEx and returns Py_NewRef(self) and run tests locally? Thanks