sumerc / yappi

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

Test Python 3.12 support #139

Closed pquentin closed 1 year ago

pquentin commented 1 year ago

I'm trying to add support for the Python 3.12 betas in https://github.com/elastic/rally/pull/1730, but am hitting this error:

  × Building wheel for yappi (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [25 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-312
      copying yappi/yappi.py -> build/lib.linux-x86_64-cpython-312
      running build_ext
      building '_yappi' extension
      creating build/temp.linux-x86_64-cpython-312
      creating build/temp.linux-x86_64-cpython-312/yappi
      gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall -fPIC -DLIB_RT_AVAILABLE=1 -I/home/runner/work/rally/rally/.nox/test-3-12/include -I/opt/hostedtoolcache/Python/3.12.0-beta.1/x64/include/python3.12 -c yappi/_yappi.c -o build/temp.linux-x86_64-cpython-312/yappi/_yappi.o
      yappi/_yappi.c: In function ‘IS_SUSPENDED’:
      yappi/_yappi.c:240:18: error: invalid use of incomplete typedef ‘PyFrameObject’ {aka ‘struct _frame’}
        240 |     return (frame->f_stacktop != NULL);
            |                  ^~
      yappi/_yappi.c: In function ‘_code2pit’:
      yappi/_yappi.c:697:29: error: ‘PyCodeObject’ has no member named ‘co_varnames’; did you mean ‘co_names’?
        697 |         co_varnames = cobj->co_varnames;
            |                             ^~~~~~~~~~~
            |                             co_names
      yappi/_yappi.c: In function ‘IS_SUSPENDED’:
      yappi/_yappi.c:242:1: warning: control reaches end of non-void function [-Wreturn-type]
        242 | }
            | ^
      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]
pquentin commented 1 year ago

Your own CI is blocked by https://github.com/python-greenlet/greenlet/pull/327

pquentin commented 1 year ago

@sumerc greenlet has issued a pre-release with Python 3.12 support, which fixed yappis's CI. You can see the tests passing here with greenlet 3.0.0a1 and my changes: https://github.com/pquentin/yappi/actions/runs/5440881956/jobs/9894253241. What do you think?

Note that GitHub Actions no longer supports Python 2.7, are you ready to drop support? I can do that in a different pull request.

jcapiitao commented 1 year ago

I submitted the PR https://github.com/sumerc/yappi/pull/145 to remove support of Python2.7

pquentin commented 1 year ago

Thanks for the review. However this was more a proof of concept and I have a lost interest since then. Feel free to reuse my pull request, it has the same license as the code itself. Thanks again!