New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clean up PEP 380 C API additions #57992
Comments
Georg noted that the PEP-380 patch added a couple of new C interfaces without documenting them. These interfaces need to be either:
PyGen_FetchStopIterationValue: probably document, explicitly noting that it also clears the StopIteration exception from the thread state PyStopIteration_Create: probably remove |
The current use of PyStopIteration_Create in genobject.c can probably be replaced with PyErr_SetObject(PyExc_StopIteration, value) anyway. |
Also check any GetAttr and CallMethod operations to see if they should be moved over to the new *Id variants. |
'PyStopIteration_Create' is just a trivial wrapper: PyObject *
PyStopIteration_Create(PyObject *value)
{
return PyObject_CallFunctionObjArgs(PyExc_StopIteration, value, NULL);
} It is not needed. As for 'PyGen_FetchStopIterationValue', does it really need to be public? It is trivial to make it private because all calls to it are in 'genobject.c'. However, I am not sure if there is a strong use case for having it public. |
There is one call to PyGen_FetchStopIterationValue in ceval.c. But I don't think it should be public. There is no real reason for the "Gen" in the name. The function is used by generator handling code, but the code itself relates to StopIteration. |
New changeset cfbf6aa5c9e3 by Nick Coghlan in branch 'default': |
New changeset 438b861e2edb by Nick Coghlan in branch 'default': |
I left the name of the new private API as _PyGen_FetchStopIterationValue. If anyone wants to make it public, they can raise a new issue to give it a more appropriate name (and move the definition accordingly). PyStopIteration_Create is simply gone, replaced by the underlying call. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: