Skip to content

When changing any multi-value variable in a def when being an import value, it changes also the value that has been imported #123839

@Gartebex-Ugandi

Description

@Gartebex-Ugandi

Bug report

Bug description:

#this will remove the 0 from i
i = [0, 1]
def o (test1) :
     test1.pop(0)
o(i)
print(i)
#it also does the thing when done like this, changing both of the used variables in a def:
e = [0, 1]
def u (test1) :
     test2 = test1
     test2.pop(0)
u(e)
print(e)

CPython versions tested on:

3.12

Operating systems tested on:

Windows

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