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

RFC: Clarify usage of macros for PySequence_Fast within the Limited C API #91417

Open
HaoZeke mannequin opened this issue Apr 8, 2022 · 3 comments
Open

RFC: Clarify usage of macros for PySequence_Fast within the Limited C API #91417

HaoZeke mannequin opened this issue Apr 8, 2022 · 3 comments
Labels
docs Documentation in the Doc dir topic-C-API

Comments

@HaoZeke
Copy link
Mannequin

HaoZeke mannequin commented Apr 8, 2022

BPO 47261
Nosy @HaoZeke

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 = None
closed_at = None
created_at = <Date 2022-04-08.15:14:46.053>
labels = ['expert-C-API', 'docs']
title = 'RFC: Clarify usage of macros for PySequence_Fast within the Limited C API'
updated_at = <Date 2022-04-08.15:19:49.541>
user = 'https://github.com/HaoZeke'

bugs.python.org fields:

activity = <Date 2022-04-08.15:19:49.541>
actor = 'rgoswami'
assignee = 'docs@python'
closed = False
closed_date = None
closer = None
components = ['Documentation', 'C API']
creation = <Date 2022-04-08.15:14:46.053>
creator = 'rgoswami'
dependencies = []
files = []
hgrepos = []
issue_num = 47261
keywords = []
message_count = 2.0
messages = ['416989', '416990']
nosy_count = 2.0
nosy_names = ['docs@python', 'rgoswami']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = None
url = 'https://bugs.python.org/issue47261'
versions = []

Linked PRs

@HaoZeke
Copy link
Mannequin Author

HaoZeke mannequin commented Apr 8, 2022

The current documentation_ of the Python-C API mentions that PySequence_Fast is part of the limited API. However, this may be a typo as all the functions interacting with a PySequence_Fast object are macros, e.g. PySequence_Fast_GET_SIZE, PySequence_Fast_GET_ITEM etc.

If this is indeed a documentation bug I'm happy to open a PR to fix this once consensus is reached.

.. _current documentation : https://docs.python.org/3/c-api/stable.html#contents-of-limited-api

@HaoZeke HaoZeke mannequin added docs Documentation in the Doc dir topic-C-API labels Apr 8, 2022
@HaoZeke HaoZeke mannequin assigned docspython Apr 8, 2022
@HaoZeke HaoZeke mannequin added docs Documentation in the Doc dir topic-C-API labels Apr 8, 2022
@HaoZeke HaoZeke mannequin assigned docspython Apr 8, 2022
@HaoZeke
Copy link
Mannequin Author

HaoZeke mannequin commented Apr 8, 2022

Perhaps to be clear, there are two possibilities:

  1. PySequence_Fast should be removed from the Limited API
  2. All macros used with PySequence_Fast are valid for use in the context of the Limited API

In either case the documentation should need to be clarified.

The only situation where no changes would result is if:

  • PySequence_Fast is part of the Limited API, but must be treated the same as a regular PySequence object
    • Since only PySequence_Size and other variants can be used in the context of the Limited API

This is actually also still confusing and should be mentioned clearly.

@HaoZeke HaoZeke mannequin changed the title RFC: Clarify Limited API macros for PySequence_Fast RFC: Clarify usage of macros for PySequence_Fast within the Limited C API Apr 8, 2022
@HaoZeke HaoZeke mannequin changed the title RFC: Clarify Limited API macros for PySequence_Fast RFC: Clarify usage of macros for PySequence_Fast within the Limited C API Apr 8, 2022
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
vstinner added a commit to vstinner/cpython that referenced this issue Jan 28, 2025
The function never worked with the limited C API. It was added by
mistake.
vstinner added a commit to vstinner/cpython that referenced this issue Jan 28, 2025
The function never worked with the limited C API. It was added by
mistake.
@vstinner
Copy link
Member

I created PR gh-129398 to remove the function PySequence_Fast() from the limited C API.

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 topic-C-API
Projects
None yet
Development

No branches or pull requests

1 participant