Commits

Yuya Nishihara committed 2339e63

thg: make sure to load threading module by main thread (fixes #1894)

threading must be loaded by main thread, but in some cases, it is loaded
inside CmdThread, which leads KeyError at exit.

Instead of excluding every module which depends on threading from demandimport,
I chose to load threading before demandimport.

Comments (0)

Files changed (1)

         if os.path.isdir(testpath) and hgpath not in sys.path:
             sys.path.insert(0, hgpath)
 
+# Make sure to load threading by main thread; otherwise, _MainThread instance
+# may have wrong thread id and results KeyError at exit.
+import threading
+
 from mercurial import demandimport
 demandimport.ignore.append('win32com.shell')
 demandimport.ignore.append('tortoisehg.util.config')