Skip to content

Iterable Unpacking is destructive on argument #158463

Description

@simon-grantham

Bug report

Using the binary asterisk operator before a zip object causes modification of the zip object itself.

Python 3.12.3 (main, Aug 31 2026, 10:18:26) [GCC 13.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> tmp1 = [1,2,3]
>>> tmp2 = [4,5,6]
>>> tmp = zip(tmp1,tmp2)
>>> print(tmp)
<zip object at 0x7bec69641340>
>>> print(list(tmp))
[(1, 4), (2, 5), (3, 6)]
>>> print(*tmp)

>>> print(list(tmp))
[]
>>> print(tmp)
<zip object at 0x7bec69641340>
>>>

CPython versions tested on:

3.12

Operating systems tested on:

Linux

Activity

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

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions