gh-111489: Add PyTuple_FromArray() function#139691
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.
Is not the empty tuple singleton a CPython implementation detail?
There was a problem hiding this comment.
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. |
| Create a tuple of *size* items and copy references from *array* to the new | ||
| tuple. |
There was a problem hiding this comment.
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/