Bug report
We have reference count contention from:
-
The classmethod object, which is stored in the MRO cache. This should be pretty easy to fix (enable deferred reference counting when creating the object).
-
sm_descr_get increfs sm->sm_callable
-
cm_descr_get creates a new PyMethod_New, which increfs cm->cm_callable and the containing class
ftscalingbench.py
class MyClassMethod:
@classmethod
def my_classmethod(cls):
return cls
@staticmethod
def my_staticmethod():
pass
@register_benchmark
def classmethod_call():
obj = MyClassMethod()
for _ in range(1000 * WORK_SCALE):
obj.my_classmethod()
@register_benchmark
def staticmethod_call():
obj = MyClassMethod()
for _ in range(1000 * WORK_SCALE):
obj.my_staticmethod()
Linked PRs