Skip to content

array iterator segfault on __setstate__() when exhausted #128961

Description

@tom-pytel

Crash report

What happened?

>>> import array
... a = array.array('i')
... it = iter(a)
... list(it)
... it.__setstate__(0)
... 
Segmentation fault (core dumped)

This goes back at least to py 3.8 (checked on that one), PR fix incoming.

CPython versions tested on:

3.14

Operating systems tested on:

Linux

Output from running 'python -VV' on the command line:

Python 3.14.0a4+ (heads/arrayiter:7d97bc8eda, Jan 17 2025, 16:24:27) [GCC 11.4.0]

Linked PRs

Activity

  1. added
    type-crashA hard crash of the interpreter, possibly with a core dump
    on Jan 17, 2025
  2. added a commit that references this issue on Jan 17, 2025
  3. tom-pytel commented on Jan 17, 2025

    @tom-pytel
    ContributorAuthor
  4. added a commit that references this issue on Jan 18, 2025
  5. added 2 commits that reference this issue on Jan 18, 2025
  6. erlend-aasland commented on Jan 18, 2025

    @erlend-aasland
    Contributor
  7. erlend-aasland commented on Jan 18, 2025

    @erlend-aasland
    Contributor

    For the record: this was discovered while the OP was working on #128943.

  8. added 2 commits that reference this issue on Jan 18, 2025
  9. added a commit that references this issue on Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    extension-modulesC modules in the Modules dirtype-crashA hard crash of the interpreter, possibly with a core dump

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions