GoogleCloudPlatform / cloud-profiler-python

Stackdriver Profiler Python agent is a tool that continuously gathers CPU usage information from Python applications
Apache License 2.0
27 stars 23 forks source link

feat: support Python 3.11 by using `_PyInternalFrame` directly #137

Closed copybara-service[bot] closed 1 year ago

copybara-service[bot] commented 1 year ago

feat: support Python 3.11 by using _PyInternalFrame directly

Fixes https://github.com/GoogleCloudPlatform/cloud-profiler-python/issues/127

The PyFrameObject structure members have been removed from the public C API in 3.11: https://docs.python.org/3/whatsnew/3.11.html#pyframeobject-3-11-hiding.

Instead, getters are provided which participate in reference counting; since this code runs as part of the SIGPROF handler, it cannot modify Python objects (including their refcounts) and the getters can't be used. Instead, we expose the internal _PyInterpreterFrame and use that directly.