<div dir="ltr"><div>> Is it possible to add a key, triggering a resize of the dict, then<br>
remove one, and continue iterating through the old (deallocated)<br>
memory?<br><br></div>You can add and remove keys between calling next which would resize the dictionary; however, it will not iterate through uninitialized memory. The dictiter holds the current index and each time next is called it goes directly to ma_keys->dk_entries[saved_<wbr>index] or ma_values[saved_index]<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Dec 13, 2016 at 12:55 PM, Chris Angelico <span dir="ltr"><<a href="mailto:rosuav@gmail.com" target="_blank">rosuav@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Wed, Dec 14, 2016 at 4:48 AM, Guido van Rossum <<a href="mailto:guido@python.org">guido@python.org</a>> wrote:<br>
> IIUC the private version gets updated every time the dict gets modified --<br>
> but what we need here should only trigger when a key is added or removed,<br>
> not when a value is updated.<br>
<br>
</span>Is it possible to add a key, triggering a resize of the dict, then<br>
remove one, and continue iterating through the old (deallocated)<br>
memory? If so, that could potentially cause a crash.<br>
<br>
ChrisA<br>
<div class="HOEnZb"><div class="h5">______________________________<wbr>_________________<br>
Python-Dev mailing list<br>
<a href="mailto:Python-Dev@python.org">Python-Dev@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-dev" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/python-dev</a><br>
Unsubscribe: <a href="https://mail.python.org/mailman/options/python-dev/joe%40quantopian.com" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/options/python-dev/<wbr>joe%40quantopian.com</a><br>
</div></div></blockquote></div><br></div>