GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||
GeezerVison is showing github.com — Add guidelines for C API with output parameters by erlend-aasland · Pull Request #1128 · python/devguide Conversation
|
| PyFoo_Bar(PyObject **out) | ||
| { | ||
| PyObject *value; | ||
| int rc = foo_bar(&value); |
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Maybe you could mimic a legacy API call which returns NULL if not found and on error, and call PyErr_Occurred(). So the difference with the two APIs is even more obvious?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
See also python/cpython#108797. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Do you need a different review? Or are you waiting for something? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
I think @encukou wants to wait until the sprint before any C API guidelines are updated in any kind of way. Correct me if I'm wrong, Petr. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Oh, I wasn't aware of that. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Some converters, like |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
As I commented on python/cpython#108797, I think the guideline should care only about the general case, not the special case. There will be deviant APIs once in a while; that's ok. BTW, |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
I concur with @erlend-aasland on that. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
FYI there is one public converter :-) I tried to move other private ones to the internal C API, but it's quite complicated: python/cpython#106320 (comment) I decided to give up in Python 3.13. I prefer to wait to see what's going on with the limited C API. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I'll leave this to the C API workgroup. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
C API: Add guidelines for C APIs with output params
There was an error while loading. Please reload this page.