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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-105927: PyWeakref_GetRef() returns 1 on success #106561

Merged
merged 2 commits into from
Jul 9, 2023

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Jul 9, 2023

PyWeakref_GetRef() now returns 1 on success, and return 0 if the reference is dead.


馃摎 Documentation preview 馃摎: https://cpython-previews--106561.org.readthedocs.build/

PyWeakref_GetRef() now returns 1 on success, and return 0 if the
reference is dead.
@vstinner
Copy link
Member Author

vstinner commented Jul 9, 2023

PR to update the newly added C API to respect the new C API guidelines: https://devguide.python.org/developer-workflow/c-api/index.html

APIs with lesser and greater results must return 0 for the lesser result, and 1 for the greater result. Consider a lookup function with a three-way return: (...)

cc @erlend-aasland

@vstinner
Copy link
Member Author

vstinner commented Jul 9, 2023

cc @encukou

Objects/weakrefobject.c Outdated Show resolved Hide resolved
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
@vstinner vstinner enabled auto-merge (squash) July 9, 2023 15:29
@vstinner
Copy link
Member Author

vstinner commented Jul 9, 2023

Thanks for the review @serhiy-storchaka.

@vstinner vstinner merged commit ee46cb6 into python:main Jul 9, 2023
22 checks passed
@vstinner vstinner deleted the weakref_getref_success branch July 9, 2023 16:10
@vstinner
Copy link
Member Author

vstinner commented Jul 9, 2023

I updated pythoncapi-compat: python/pythoncapi-compat@d000b55

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants