Yappi should be removed from the project, at least for now.
Yappi is a developer tool, and while it wasn’t great it was just left in to take up space, it is now a real problem because yappi is broken with Python 3.11 and the yappi developer has no real plan to fix it .
Please see this thread:
opened 01:19PM - 28 Jun 22 UTC
closed 08:24AM - 22 Aug 22 UTC
When trying to build yappi with 3.11, it fails with following trace:
/tmp/tim… er_createf6naxck_.c: In function ‘main’:
/tmp/timer_createf6naxck_.c:2:5: warning: implicit declaration of function ‘timer_create’ [-Wimplicit-function-declaration]
2 | timer_create();
| ^~~~~~~~~~~~
running build
running build_py
running build_ext
building '_yappi' extension
gcc -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DLIB_RT_AVAILABLE=1 -I/usr/include/python3.11 -c yappi/_yappi.c -o build/temp.linux-x86_64-3.11/yappi/_yappi.o
yappi/_yappi.c: In function ‘IS_SUSPENDED’:
yappi/_yappi.c:220:18: error: invalid use of incomplete typedef ‘PyFrameObject’ {aka ‘struct _frame’}
220 | return (frame->f_state == FRAME_SUSPENDED);
| ^~
yappi/_yappi.c:220:31: error: ‘FRAME_SUSPENDED’ undeclared (first use in this function); did you mean ‘IS_SUSPENDED’?
220 | return (frame->f_state == FRAME_SUSPENDED);
| ^~~~~~~~~~~~~~~
| IS_SUSPENDED
yappi/_yappi.c:220:31: note: each undeclared identifier is reported only once for each function it appears in
yappi/_yappi.c: In function ‘IS_ASYNC’:
yappi/_yappi.c:232:19: error: invalid use of incomplete typedef ‘PyFrameObject’ {aka ‘struct _frame’}
232 | result = frame->f_code->co_flags & CO_COROUTINE ||
| ^~
yappi/_yappi.c:233:14: error: invalid use of incomplete typedef ‘PyFrameObject’ {aka ‘struct _frame’}
233 | frame->f_code->co_flags & CO_ITERABLE_COROUTINE;
| ^~
yappi/_yappi.c:236:29: error: invalid use of incomplete typedef ‘PyFrameObject’ {aka ‘struct _frame’}
236 | result = result || frame->f_code->co_flags & CO_ASYNC_GENERATOR;
| ^~
yappi/_yappi.c: In function ‘_code2pit’:
yappi/_yappi.c:653:16: error: invalid use of incomplete typedef ‘PyFrameObject’ {aka ‘struct _frame’}
653 | cobj = fobj->f_code;
| ^~
yappi/_yappi.c:673:72: error: ‘PyCodeObject’ has no member named ‘co_varnames’; did you mean ‘co_names’?
673 | const char *firstarg = PyStr_AS_CSTRING(PyTuple_GET_ITEM(cobj->co_varnames, 0));
| ^~~~~~~~~~~
yappi/_yappi.c:182:46: note: in definition of macro ‘PyStr_AS_CSTRING’
182 | #define PyStr_AS_CSTRING(s) PyUnicode_AsUTF8(s)
| ^
/usr/include/python3.11/cpython/tupleobject.h:18:33: note: in expansion of macro ‘_Py_CAST’
18 | (assert(PyTuple_Check(op)), _Py_CAST(PyTupleObject*, (op)))
| ^~~~~~~~
/usr/include/python3.11/cpython/tupleobject.h:30:38: note: in expansion of macro ‘_PyTuple_CAST’
30 | #define PyTuple_GET_ITEM(op, index) (_PyTuple_CAST(op)->ob_item[index])
| ^~~~~~~~~~~~~
yappi/_yappi.c:673:49: note: in expansion of macro ‘PyTuple_GET_ITEM’
673 | const char *firstarg = PyStr_AS_CSTRING(PyTuple_GET_ITEM(cobj->co_varnames, 0));
| ^~~~~~~~~~~~~~~~
yappi/_yappi.c: In function ‘IS_SUSPENDED’:
yappi/_yappi.c:224:1: warning: control reaches end of non-void function [-Wreturn-type]
224 | }
| ^
error: command '/usr/bin/gcc' failed with exit code 1
Errors seems related to documented changes in release notes:
https://docs.python.org/3.11/whatsnew/3.11.html
and this discussion:
Hi everyone, I am the maintainer of a tracing profiler written in C called yappi (sumerc/yappi/) and Blackfire. I have been using some weird ways/undocumented structures/APIs and somehow maintaining it for 10 years, but this 3.11 version was really,...
Reading time: 6 mins 🕑
Likes: 25 ❤
Yappi is unlikely to be fixed for Python 3.11, and may even be redundant with Python 3.12 when it comes out. Even if there is still a need for yappi with python 3.12, 3.12 isn’t due out for a year.
Please strip out yappi as a mandatory component.