# HG changeset patch
# User Matt Harbison <
matt_h...@yahoo.com>
# Date 1649882367 14400
# Wed Apr 13 16:39:27 2022 -0400
# Branch stable
# Node ID ff02b8b1ea50b1650b26d83d285faebd79e3c195
# Parent 3e5fda652844db35c237b851b5852e10a8e2f84c
run: avoid using an uninitialized `ui` object in the exception handler
Found when porting to the py3 form of py2exe. I have no idea what the assertion
error was. Unconditionally print a stacktrace in this case, so the cause can be
determined.
Traceback (most recent call last):
File "tortoisehg\hgqt\run.pyc", line 133, in dispatch
File "mercurial\ui.pyc", line 316, in load
File "mercurial\rcutil.pyc", line 98, in rccomponents
File "mercurial\rcutil.pyc", line 68, in default_rc_resources
File "mercurial\utils\resourceutil.pyc", line 106, in contents
File "<frozen zipimport>", line 775, in contents
AssertionError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "thg", line 99, in <module>
File "tortoisehg\hgqt\run.pyc", line 103, in run
File "tortoisehg\hgqt\run.pyc", line 147, in dispatch
AttributeError: 'NoneType' object has no attribute 'configbool'
diff --git a/tortoisehg/hgqt/run.py b/tortoisehg/hgqt/run.py
--- a/tortoisehg/hgqt/run.py
+++ b/tortoisehg/hgqt/run.py
@@ -144,9 +144,13 @@
except Exception as e:
if b'--debugger' in args:
pdb.post_mortem(sys.exc_info()[2])
- if u.configbool(b'tortoisehg', b'traceback'):
+ if u and u.configbool(b'tortoisehg', b'traceback'):
raise
qtapp.earlyBugReport(e)
+
+ if not u:
+ raise
+
return -1
except KeyboardInterrupt:
print(_('\nCaught keyboard interrupt, aborting.\n'))