> and I also don’t see any clue in the source as to when [list mutation]
> would actually happen. Since inside the loop, the list object `v` is
> never accessed other than passing `v->ob_item[i]` to the recursive
> repr call, there shouldn’t be any mutation on the list object itself.
The individual object can have a reference to the list and (in extreme
cases) do with it what it pleases:
class Evil:
def __init__(self, l):
self.l = l
def __repr__(self):
del l[:]
return "evil"
l = []
l.append(Evil(l))
l.append(Evil(l))
print(l)
That is not something normal Python code does, but it shouldn't be
allowed to crash the interpreter, either.
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com