Skip to content

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

Merged
vstinner merged 2 commits into
python:mainfrom
vstinner:weakref_getref_success
Jul 9, 2023
Merged

gh-105927: PyWeakref_GetRef() returns 1 on success#106561
vstinner merged 2 commits into
python:mainfrom
vstinner:weakref_getref_success

Conversation

@vstinner

@vstinnervstinner commented Jul 9, 2023

Copy link
Copy Markdown
Member

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
Copy Markdown
MemberAuthor

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
Copy Markdown
MemberAuthor

cc @encukou

Comment threadObjects/weakrefobject.c Outdated
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
@vstinner
vstinner enabled auto-merge (squash) July 9, 2023 15:29
@vstinner

Copy link
Copy Markdown
MemberAuthor

Thanks for the review @serhiy-storchaka.

@vstinner
vstinner merged commit ee46cb6 into python:mainJul 9, 2023
@vstinner
vstinner deleted the weakref_getref_success branch July 9, 2023 16:10
@vstinner

Copy link
Copy Markdown
MemberAuthor

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

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@vstinner@serhiy-storchaka@bedevere-bot