[New-bugs-announce] [issue5853] mimetypes.guess_type() hits recursion limit

djc report at bugs.python.org
Mon Apr 27 10:57:07 CEST 2009


New submission from djc <dirkjan at ochtman.nl>:

I've got hgweb (the Mercurial web app) crashing on guess_type() in
2.6.2, but not in 2.5.4. I'm passing in a filename like
'/home/djc/src/hg/crew/templates/static/hglogo.png'. Doesn't happen on
the REPL, but happens in side the hg serve web server.

Traceback (most recent call last):
  File "/home/djc/src/hg/crew/mercurial/hgweb/server.py", line 67, in
do_POST
    self.do_write()
  File "/home/djc/src/hg/crew/mercurial/hgweb/server.py", line 60, in
do_write
    self.do_hgweb()
  File "/home/djc/src/hg/crew/mercurial/hgweb/server.py", line 124, in
do_hgweb
    for chunk in self.server.application(env, self._start_response):
  File "/home/djc/src/hg/crew/mercurial/hgweb/hgwebdir_mod.py", line 91,
in __call__
    return self.run_wsgi(req)
  File "/home/djc/src/hg/crew/mercurial/hgweb/hgwebdir_mod.py", line
132, in run_wsgi
    return (staticfile(static, fname, req),)
  File "/home/djc/src/hg/crew/mercurial/hgweb/common.py", line 73, in
staticfile
    ct = mimetypes.guess_type(path)[0] or "text/plain"
  File "/usr/lib/python2.6/mimetypes.py", line 244, in guess_type
    return guess_type(url, strict)
(... snip ...)
  File "/usr/lib/python2.6/mimetypes.py", line 244, in guess_type
    return guess_type(url, strict)
RuntimeError: maximum recursion depth exceeded

----------
components: Library (Lib)
messages: 86649
nosy: djc, georg.brandl
severity: normal
status: open
title: mimetypes.guess_type() hits recursion limit
versions: Python 2.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5853>
_______________________________________


More information about the New-bugs-announce mailing list