From 7b3b6f70e6daeabb14c2b79f23367bda8a2772ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=BCmer=20Cip?= Date: Thu, 18 Aug 2022 12:31:03 +0300 Subject: [PATCH 06/11] Use PyCode_GetVarnames -- added in 3.11.0rc1 --- yappi/_yappi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/yappi/_yappi.c b/yappi/_yappi.c index 5a3f78a..641cc84 100644 --- a/yappi/_yappi.c +++ b/yappi/_yappi.c @@ -687,8 +687,9 @@ _code2pit(PyFrameObject *fobj, uintptr_t current_tag) Py_INCREF(cobj); if (cobj->co_argcount) { - // todo: 3.12 this might be a public API - PyObject *co_varnames = _PyCode_GetVarnames(cobj); + // There has been a lot going on with `co_varnames`, but finally in + // 3.11.0rc1, it is added as a public API + PyObject *co_varnames = PyCode_GetVarnames(cobj); const char *firstarg = PyStr_AS_CSTRING(PyTuple_GET_ITEM(co_varnames, 0)); if (!strcmp(firstarg, "self")) { -- 2.34.1