sumerc / yappi

Yet Another Python Profiler, but this time multithreading, asyncio and gevent aware.
MIT License
1.44k stars 72 forks source link

yappi fails to build with python 3.11 #104

Closed amoralej closed 2 years ago

amoralej commented 2 years ago

When trying to build yappi with 3.11, it fails with following trace:

/tmp/timercreatef6naxck.c: In function ‘main’: /tmp/timercreatef6naxck.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