-
-
Notifications
You must be signed in to change notification settings - Fork 33.1k
gh-111489: Add PyTuple_FromArray() function #139691
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
Conversation
@serhiy-storchaka: I addressed your comments. Please review the updated PR. |
|
||
tup = () | ||
copy = tuple_fromarray(tup) | ||
self.assertIs(copy, tup) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is not the empty tuple singleton a CPython implementation detail?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The whole file is a CPython implementation detail (_testcapi), no?
Use also UNINITIALIZED_SIZE in test code.
I updated the PR for the latest review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. 👍
Create a tuple of *size* items and copy references from *array* to the new | ||
tuple. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to formulate this in words more similar to PyTuple_New()
or PyTuple_Pack()
("Return a new tuple object of size ... "), but this is not so important.
Implementation looks good, thanks! Do you want to open a WG vote for this? |
I created capi-workgroup/decisions#79. |
I exchanged
|
caad089
to
89f91fc
Compare
Sorry, I changed my preference back to |
The C API Working Group accepted this API. |
Merged. Thanks for your review @serhiy-storchaka and @encukou! |
I added the function to pythoncapi-compat: python/pythoncapi-compat@89e023e |
📚 Documentation preview 📚: https://cpython-previews--139691.org.readthedocs.build/