Python C extension using the Limited API: how to get the value of __debug__?

  Kiến thức lập trình

I’m coding a C extension for Python.

I used the non-limited API and recently switched to Python’s limited API. And with that new API, I can’t see a way to get the value of the global __debug__ variable.

Previously I used the Py_OptimizeFlag variable but that variable is not available within the limited API. (And is deprecated in Python 3.12, so we won’t see ever see it in the limited API anyway).

Does anyone have a solution for that ?

I tried many, many solutions. Couldn’t find anything useful in the doc by myself and Google didn’t helped.

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website