[Trac] RuntimeError in tracoverlayview/web_ui.py when iterating over MIME types with Python 2.7

MaĆ«l <[email protected]> Thu, 18 Jun 2026 02:08:54 -0700 (PDT)
Newsgroups gmane.comp.version-control.subversion.trac.general
Message-ID <[email protected]>
------=_Part_64758_384595148.1781773734186
Content-Type: multipart/alternative; 
	boundary="----=_Part_64759_50588000.1781773734186"

------=_Part_64759_50588000.1781773734186
Content-Type: text/plain; charset="UTF-8"

Hello,

We encountered a runtime issue with the *tracoverlayview plugin* when 
running under Python 2.7.

The error is caused by iterating over a dictionary while it may be modified 
during the loop. In our case, the issue occurs in 
*tracoverlayview/web_ui.py*, in the* _get_mimetypes()* method:
*for ext, mimetype in _iteritems(map_):*

This can raise the following error:
*RuntimeError: dictionary changed size during iteration*

We applied the following local patch to iterate over a static list of items 
instead:
*for ext, mimetype in list(_iteritems(map_)):*

Suggested patch:
-            for ext, mimetype in _iteritems(map_):
+           for ext, mimetype in list(_iteritems(map_)):

This fixes the issue in our environment.
Thank you.

-- 
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trac-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
To view this discussion visit https://groups.google.com/d/msgid/trac-users/2104ae2c-43df-41b5-9c4a-e6de880dc64an%40googlegroups.com.

------=_Part_64759_50588000.1781773734186
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Hello,<br /><br />We encountered a runtime issue with the <u>tracoverlayvie=
w plugin</u> when running under Python 2.7.<br /><br />The error is caused =
by iterating over a dictionary while it may be modified during the loop. In=
 our case, the issue occurs in <i>tracoverlayview/web_ui.py</i>, in the<i> =
_get_mimetypes()</i> method:<br /><i>for ext, mimetype in _iteritems(map_):=
</i><div><br /></div><div>This can raise the following error:<br /><i>Runti=
meError: dictionary changed size during iteration</i></div><div><br />We ap=
plied the following local patch to iterate over a static list of items inst=
ead:<br /><i>for ext, mimetype in list(_iteritems(map_)):</i></div><div><br=
 />Suggested patch:<br />- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0for ext=
, mimetype in _iteritems(map_):<br />+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0for ext, mimetype in list(_iteritems(map_)):</div><div><br />This fix=
es the issue in our environment.<br />Thank you.</div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;Trac Users&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:trac-users+unsubscribe-/[email protected]">trac-use=
rs+unsubscribe-/[email protected]</a>.<br />
To view this discussion visit <a href=3D"https://groups.google.com/d/msgid/=
trac-users/2104ae2c-43df-41b5-9c4a-e6de880dc64an%40googlegroups.com?utm_med=
ium=3Demail&utm_source=3Dfooter">https://groups.google.com/d/msgid/trac-use=
rs/2104ae2c-43df-41b5-9c4a-e6de880dc64an%40googlegroups.com</a>.<br />

------=_Part_64759_50588000.1781773734186--

------=_Part_64758_384595148.1781773734186--