hgweb: pre-init mimetypes module (fixes ugly bug in python-2.6.2 mimetypes)
authorDirkjan Ochtman <dirkjan@ochtman.nl>
Mon, 27 Apr 2009 16:29:26 +0200
changeset 8224 1075f5c1b3fa
parent 8223 02145b700fe4
child 8225 46293a0c7e9f
hgweb: pre-init mimetypes module (fixes ugly bug in python-2.6.2 mimetypes) The ugly initialization hack in mimetypes' initialization procedure can make hg serve hit the maximum recursion depth when in threaded mode.
mercurial/hgweb/server.py
--- a/mercurial/hgweb/server.py	Mon Apr 27 16:26:31 2009 +0200
+++ b/mercurial/hgweb/server.py	Mon Apr 27 16:29:26 2009 +0200
@@ -283,6 +283,9 @@
     else:
         handler = _hgwebhandler
 
+    # ugly hack due to python issue5853 (for threaded use)
+    import mimetypes; mimetypes.init()
+
     try:
         if use_ipv6:
             return IPv6HTTPServer((address, port), handler)