Skip to content

Conversation

@vstinner
Copy link
Member

@vstinner vstinner commented Jun 27, 2023

PyTuple_SET_ITEM() and PyList_SET_ITEM() now check the index argument
with an assertion if Python is built in debug mode or is built with
assertions.

  • list_extend() and _PyList_AppendTakeRef() now set the list size
    before calling PyList_SET_ITEM().
  • PyStructSequence_GetItem() and PyStructSequence_SetItem() now check
    the index argument: must be lesser than REAL_SIZE(op).
  • PyStructSequence_GET_ITEM() and PyStructSequence_SET_ITEM() are now
    aliases to PyStructSequence_GetItem() and
    PyStructSequence_SetItem().

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

@vstinner vstinner force-pushed the list_get_item_assert branch from 255edc3 to 9e5b27b Compare June 27, 2023 23:55
@vstinner vstinner changed the title PyList_GET_ITEM() now checks the index PyList_SET_ITEM() now checks the index Jun 27, 2023
@vstinner vstinner changed the title PyList_SET_ITEM() now checks the index gh-106168: PyTuple_SET_ITEM() now checks the index Jun 28, 2023
PyTuple_SET_ITEM() and PyList_SET_ITEM() now check the index argument
with an assertion if Python is built in debug mode or is built with
assertions.

* list_extend() and _PyList_AppendTakeRef() now set the list size
  before calling PyList_SET_ITEM().
* PyStructSequence_GetItem() and PyStructSequence_SetItem() now check
  the index argument: must be lesser than REAL_SIZE(op).
* PyStructSequence_GET_ITEM() and PyStructSequence_SET_ITEM() are now
  aliases to PyStructSequence_GetItem() and
  PyStructSequence_SetItem().
@vstinner vstinner force-pushed the list_get_item_assert branch from 9e5b27b to fb5b51b Compare June 28, 2023 01:05
@vstinner vstinner merged commit 3f8483c into python:main Jun 28, 2023
@vstinner vstinner deleted the list_get_item_assert branch June 28, 2023 01:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants