[Python-Dev] List mutation in list_repr?

2016-12-06 Thread Patrick Westerhoff
Hey all, I just stumbled on the following comment in the C source of the repr implementation for the list object: /* Do repr() on each element. Note that this may mutate the list, so must refetch the list size on each iteration. */ (as seen in list_repr implementation [1]) I’m honest

Re: [Python-Dev] List mutation in list_repr?

2016-12-07 Thread Patrick Westerhoff
On Tue, Dec 6, 2016 at 5:32 PM, Random832 wrote: > It *shouldn't*, but it can't be enforced. It's one of those things where > if Python assumes all user code is sane (in this case, overridden > __repr__ not messing with the list) it can bite in a way that could > cause the interpreter to crash. I