| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
| PyCode_GetCode(PyObject *co) | ||
| { | ||
| if (!PyCode_Check(co)) { | ||
| PyErr_BadInternalCall(); |
There was a problem hiding this comment.
I forgot if this or a TypeError is preferred for the C API (or no error setting at all?)
Sorry, something went wrong.
There was a problem hiding this comment.
Use PyCode_GetCode(PyCodeObject *co) and then you won't need the check.
Sorry, something went wrong.
There was a problem hiding this comment.
I would like to, but co_code was previously PyObject*, and I want this to be a drop-in replacement as far as possible.
Sorry, something went wrong.
There was a problem hiding this comment.
PyErr_BadInternalCall() is fine, but I would even suggest replacing a runtime check with an assertion. The caller is responsible to pass the right type.
Sorry, something went wrong.
|
Also I frankly have no clue if we need to update stable_abi.toml. I'm not sure when it counts as stable ABI and when it doesn't. |
Sorry, something went wrong.
| PyCode_GetCode(PyObject *co) | ||
| { | ||
| if (!PyCode_Check(co)) { | ||
| PyErr_BadInternalCall(); |
There was a problem hiding this comment.
PyErr_BadInternalCall() is fine, but I would even suggest replacing a runtime check with an assertion. The caller is responsible to pass the right type.
Sorry, something went wrong.
Include/cpython/ is the API excluded from the limited C API and so excluded from the stable ABI: https://devguide.python.org/c-api/ Please don't add this function to the stable ABI yet. Let's wait for one Python release, and then see if it's stable or not. |
Sorry, something went wrong.
|
I prepared PR python/pythoncapi-compat#34 to add the function to pythoncapi-compat. |
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM.
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Fixes #92154.