##// END OF EJS Templates
hgweb: use importlib.reload() if available...
Gregory Szorc -
r43339:e554cfd9 default
parent child Browse files
Show More
@@ -9,6 +9,7 b''
9 from __future__ import absolute_import
9 from __future__ import absolute_import
10
10
11 import errno
11 import errno
12 import importlib
12 import os
13 import os
13 import socket
14 import socket
14 import sys
15 import sys
@@ -370,7 +371,11 b' def create_server(ui, app):'
370 # codec is hardcoded as ascii.
371 # codec is hardcoded as ascii.
371
372
372 sys.argv # unwrap demand-loader so that reload() works
373 sys.argv # unwrap demand-loader so that reload() works
373 reload(sys) # resurrect sys.setdefaultencoding()
374 # resurrect sys.setdefaultencoding()
375 try:
376 importlib.reload(sys)
377 except AttributeError:
378 reload(sys)
374 oldenc = sys.getdefaultencoding()
379 oldenc = sys.getdefaultencoding()
375 sys.setdefaultencoding("latin1") # or any full 8-bit encoding
380 sys.setdefaultencoding("latin1") # or any full 8-bit encoding
376 mimetypes.init()
381 mimetypes.init()
@@ -22,4 +22,5 b' run pyflakes on all tracked files ending'
22 > 2>/dev/null \
22 > 2>/dev/null \
23 > | xargs pyflakes 2>/dev/null | "$TESTDIR/filterpyflakes.py"
23 > | xargs pyflakes 2>/dev/null | "$TESTDIR/filterpyflakes.py"
24 contrib/perf.py:*: undefined name 'xrange' (glob) (?)
24 contrib/perf.py:*: undefined name 'xrange' (glob) (?)
25 mercurial/hgweb/server.py:*: undefined name 'reload' (glob) (?)
25
26
General Comments 0
You need to be logged in to leave comments. Login now