Uh oh!
There was an error while loading. Please reload this page.
gh-111489: Add PyTuple_FromArray() function - #139691
Conversation
vstinner
commented
Oct 7, 2025
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
vstinner
commented
Oct 7, 2025
@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?
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Use also UNINITIALIZED_SIZE in test code.
vstinner
commented
Oct 7, 2025
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.
encukou
commented
Oct 7, 2025
Implementation looks good, thanks! Do you want to open a WG vote for this? |
vstinner
commented
Oct 7, 2025
I created capi-workgroup/decisions#79. |
I exchanged
|
vstinner
commented
Oct 8, 2025
Sorry, I changed my preference back to |
vstinner
commented
Oct 10, 2025
The C API Working Group accepted this API. |
vstinner
commented
Oct 10, 2025
Merged. Thanks for your review @serhiy-storchaka and @encukou! |
vstinner
commented
Oct 14, 2025
I added the function to pythoncapi-compat: python/pythoncapi-compat@89e023e |
📚 Documentation preview 📚: https://cpython-previews--139691.org.readthedocs.build/