Skip to content

gh-161694: [C API] Add PyTupleWriter API - #161639

Draft
vstinner wants to merge 5 commits into
python:mainfrom
vstinner:tuplewriter
Draft

vstinner wants to merge 5 commits into
python:mainfrom
vstinner:tuplewriter

Conversation

@vstinner

@vstinner vstinner commented Nov 8, 2026 •

Copy link
Copy Markdown
Member

Add _PyTuple_ResizeKeepOnError(). It copies the tuple
when shrinking the tuple to leave the tuple unchanged on error.

@read-the-docs-community

read-the-docs-community Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #35770548 | 📁 Comparing 6bf33a8 against main (eba2a21)

  🔍 Preview build  

7 files changed · ± 7 modified

± Modified

@vstinner
vstinner force-pushed the tuplewriter branch 2 times, most recently from 9796499 to 0f28d27 Compare November 8, 2026 20:25
@vstinner

vstinner commented Nov 8, 2026

Copy link
Copy Markdown
Member Author

Oh. There are some legit test failures. Example:

test_structseq_newtype_null_descr_doc (test.test_capi.test_misc.Test_testcapi.test_structseq_newtype_null_descr_doc) ... python: ../cpython-ro-srcdir/Include/internal/pycore_tuple.h:119: _PyTupleWriter_CheckConsistency: Assertion `Py_REFCNT(tuple) == 1' failed.
Fatal Python error: Aborted

Current thread 0x000075e4dba4f780 [python] (most recent call first):
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/unittest/case.py", line 637 in _callTestMethod

@vstinner
vstinner force-pushed the tuplewriter branch 2 times, most recently from 7d44c78 to d61541f Compare November 9, 2026 17:36
@vstinner vstinner changed the title [C API] Add PyTupleWriter API gh-161694: [C API] Add PyTupleWriter API Nov 9, 2026
@bedevere-app bedevere-app Bot added the type-feature A feature request or enhancement label Nov 9, 2026
@vstinner

vstinner commented Nov 9, 2026

Copy link
Copy Markdown
Member Author

Oh. I published this PR on cpython by mistake :-( I was trying to create a PR on my personal fork. So it seems like I have to finish the PR to make it ready for review :-D

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

Labels

type-feature A feature request or enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant