Skip to content

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

Co-authored-by: Serhiy Storchaka <[email protected]>
@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
@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.

3 participants