New submission from Adam Cmiel :
Python version:
Python 3.8.3 (default, May 15 2020, 00:00:00)
[GCC 10.1.1 20200507 (Red Hat 10.1.1-1)] on linux
Description:
When assigning to a tuple index using +=, if the element at that index is a
list, the list is extended and a TypeError is raised.
a = ([],)
try:
a[0] += [1]
except TypeError:
assert a != ([1],) # assertion fails
else:
assert a == ([1],)
The expected behaviour is that only one of those things would happen (probably
the list being extended with no error, given that a[0].extend([1]) works fine).
--
components: Interpreter Core
messages: 370990
nosy: Adam Cmiel
priority: normal
severity: normal
status: open
title: Unexpected behaviour for += assignment to list inside tuple
type: behavior
versions: Python 3.8
___
Python tracker
<https://bugs.python.org/issue40911>
___
___
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com