Skip to content
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

Closed
ncoghlan opened this issue Jan 14, 2012 · 8 comments
Closed

Clean up PEP 380 C API additions #57992

ncoghlan opened this issue Jan 14, 2012 · 8 comments
Assignees
Labels
docs Documentation in the Doc dir interpreter-core (Objects, Python, Grammar, and Parser dirs) release-blocker type-feature A feature request or enhancement

Comments

@ncoghlan
Copy link
Contributor

BPO 13783
Nosy @ncoghlan, @meadori, @markshannon

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:

assignee = 'https://github.com/ncoghlan'
closed_at = <Date 2012-06-17.05:48:44.379>
created_at = <Date 2012-01-14.06:19:46.542>
labels = ['interpreter-core', 'type-feature', 'release-blocker', 'docs']
title = 'Clean up PEP 380 C API additions'
updated_at = <Date 2012-06-17.05:48:44.378>
user = 'https://github.com/ncoghlan'

bugs.python.org fields:

activity = <Date 2012-06-17.05:48:44.378>
actor = 'ncoghlan'
assignee = 'ncoghlan'
closed = True
closed_date = <Date 2012-06-17.05:48:44.379>
closer = 'ncoghlan'
components = ['Documentation', 'Interpreter Core']
creation = <Date 2012-01-14.06:19:46.542>
creator = 'ncoghlan'
dependencies = []
files = []
hgrepos = []
issue_num = 13783
keywords = []
message_count = 8.0
messages = ['151235', '151236', '151254', '151759', '162714', '163013', '163016', '163017']
nosy_count = 5.0
nosy_names = ['ncoghlan', 'meador.inge', 'docs@python', 'Mark.Shannon', 'python-dev']
pr_nums = []
priority = 'release blocker'
resolution = 'fixed'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue13783'
versions = ['Python 3.3']

@ncoghlan
Copy link
Contributor Author

Georg noted that the PEP-380 patch added a couple of new C interfaces without documenting them. These interfaces need to be either:

  1. Documented;
  2. Made private; or
  3. Removed (if they're completely trivial)

PyGen_FetchStopIterationValue: probably document, explicitly noting that it also clears the StopIteration exception from the thread state

PyStopIteration_Create: probably remove

@ncoghlan ncoghlan added docs Documentation in the Doc dir interpreter-core (Objects, Python, Grammar, and Parser dirs) labels Jan 14, 2012
@ncoghlan
Copy link
Contributor Author

The current use of PyStopIteration_Create in genobject.c can probably be replaced with PyErr_SetObject(PyExc_StopIteration, value) anyway.

@ncoghlan
Copy link
Contributor Author

Also check any GetAttr and CallMethod operations to see if they should be moved over to the new *Id variants.

@meadori
Copy link
Member

meadori commented Jan 22, 2012

'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.

@meadori meadori added the type-feature A feature request or enhancement label Jan 22, 2012
@ncoghlan ncoghlan assigned ncoghlan and unassigned docspython Jun 12, 2012
@markshannon
Copy link
Member

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.
Perhaps it should be moved to errors.c and renamed _PyErr_FetchStopIterationValue.

@python-dev
Copy link
Mannequin

python-dev mannequin commented Jun 17, 2012

New changeset cfbf6aa5c9e3 by Nick Coghlan in branch 'default':
Issue bpo-13783: the PEP-380 implementation no longer expands the public C API
http://hg.python.org/cpython/rev/cfbf6aa5c9e3

@python-dev
Copy link
Mannequin

python-dev mannequin commented Jun 17, 2012

New changeset 438b861e2edb by Nick Coghlan in branch 'default':
Issue bpo-13783: PEP-380 cleanup part 2, using the new identifier APIs in the generator implementation
http://hg.python.org/cpython/rev/438b861e2edb

@ncoghlan
Copy link
Contributor Author

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.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir interpreter-core (Objects, Python, Grammar, and Parser dirs) release-blocker type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

3 participants