Thanks to visit codestin.com
Credit goes to github.com

Skip to content

The docstrings for PyMapping_Values, PyMapping_Items and PyMapping_Keys are incorrect #119391

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

Closed
eendebakpt opened this issue May 22, 2024 · 1 comment
Labels
docs Documentation in the Doc dir topic-C-API

Comments

@eendebakpt
Copy link
Contributor

eendebakpt commented May 22, 2024

Documentation

The docstring for PyMapping_Keys

/* On success, return a list or tuple of the keys in mapping object 'o'.

does not reflect the documentation (see https://docs.python.org/3/c-api/mapping.html#c.PyMapping_Keys) or the implementation (see abstract.c#L2519) as PyMapping_Keys can only return a list. Similar for the other methods.

The docstrings show up in IDEs (such as Visual Studio Code) and can cause confusion. I encountered this when working on the making the json module compatible with free-threading

Linked PRs

@devdanzin
Copy link
Contributor

The docstrings became incorrect after 0ccc0f6.

erlend-aasland pushed a commit that referenced this issue May 22, 2024
…lues and PyMapping_Keys (#119392)

The behaviour was changed in 0ccc0f6.
estyxx pushed a commit to estyxx/cpython that referenced this issue Jul 17, 2024
…ing_Values and PyMapping_Keys (python#119392)

The behaviour was changed in 0ccc0f6.
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

4 participants