Skip to content

Conversation

serhiy-storchaka
Copy link
Member

@serhiy-storchaka serhiy-storchaka commented Dec 31, 2024

Non-tuple sequences are deprecated as argument for the "(items)" format unit in PyArg_ParseTuple() and other argument parsing functions if items contains format units which store borrowed buffer or reference (e.g. "s" and "O").

str and bytearray are no longer accepted as valid sequences.


📚 Documentation preview 📚: https://cpython-previews--128374.org.readthedocs.build/

…seTuple()

Non-tuple sequences are deprecated as argument for the "(items)" format unit
in PyArg_ParseTuple() and other argument parsing functions if items contains
format units which store borrowed buffer or reference (e.g. "s" and "O").

str and bytearray are no longer accepted as valid sequences.
Copy link
Member

@picnixz picnixz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I understand that "borrowed buffer or reference" reads as "borrowed buffer or borrowed reference", I would advise repeating "borrowed reference" as well.

I haven't looked at te implementation though.

Co-authored-by: Bénédikt Tran <[email protected]>
Co-authored-by: Stan Ulbrych <[email protected]>
@erlend-aasland
Copy link
Contributor

While I understand that "borrowed buffer or reference" reads as "borrowed buffer or borrowed reference", I would advise repeating "borrowed reference" as well.

In this case, I think we should consider being explicit, rather than worrying about the repeated word.

@serhiy-storchaka
Copy link
Member Author

This didn't cause much controversy when posted on Discourse, so I just merge it. There will be time to tweak or revert it.

@serhiy-storchaka serhiy-storchaka merged commit 0e4cf9c into python:main Apr 8, 2025
42 checks passed
seehwan pushed a commit to seehwan/cpython that referenced this pull request Apr 16, 2025
…seTuple() (pythonGH-128374)

Non-tuple sequences are deprecated as argument for the "(items)" format unit
in PyArg_ParseTuple() and other argument parsing functions if items contains
format units which store borrowed buffer or reference (e.g. "s" and "O").

str and bytearray are no longer accepted as valid sequences.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants