Re: [Trac] RuntimeError in tracoverlayview/web_ui.py when iterating over MIME types with Python 2.7
Jun Omae <[email protected]> Thu, 18 Jun 2026 20:18:51 +0900
| Newsgroups | gmane.comp.version-control.subversion.trac.general |
|---|---|
| Message-ID | <CAEVLMahymUhWNE2XccBOxbgqyzVTgOY+a9U-RDh6RJ3uhDFiaQ@mail.gmail.com> |
On Thu, Jun 18, 2026 at 6:08=E2=80=AFPM Ma=C3=ABl <mael.fcbarcelone@outlook= .fr> wrote: > > Hello, > > We encountered a runtime issue with the tracoverlayview plugin when runni= ng under Python 2.7. > > The error is caused by iterating over a dictionary while it may be modifi= ed 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 ite= ms 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. Thanks for the reporting. But unable to reproduce the issue. Also, very weird. The "map_" is not modified after initialized by Trac core and mimetypes module. I don't believe the error is raised. --=20 Jun Omae <[email protected]> (=E5=A4=A7=E5=89=8D =E6=BD=A4) --=20 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 e= mail to trac-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected] To view this discussion visit https://groups.google.com/d/msgid/trac-users/= CAEVLMahymUhWNE2XccBOxbgqyzVTgOY%2Ba9U-RDh6RJ3uhDFiaQ%40mail.gmail.com.