import _testinternalcapi import functools import pyperf runner = pyperf.Runner() obj = None _testinternalcapi.test_bench, id, obj # builtins.id() is declared with METH_O calling convention runner.bench_time_func("bench", _testinternalcapi.test_bench, id, obj)