Fix StopIteration handling in _init_late_modules.
This caused a PendingDeprecationWarning with Python 3.5: Traceback (most recent call last): File "/home/florian/proj/qutebrowser/git/qutebrowser/utils/debug.py", line 237, in log_time yield File "/home/florian/proj/qutebrowser/git/qutebrowser/app.py", line 433, in _init_late_modules next(reader) StopIteration During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/florian/proj/qutebrowser/git/qutebrowser/app.py", line 433, in _init_late_modules next(reader) File "/usr/lib64/python3.5/contextlib.py", line 77, in __exit__ self.gen.throw(type, value, traceback) PendingDeprecationWarning: generator 'log_time' raised StopIteration
This commit is contained in:
parent
07c02041fc
commit
f972d043c5
@ -428,19 +428,19 @@ def _init_modules(args, crash_handler):
|
||||
|
||||
def _init_late_modules(args):
|
||||
"""Initialize modules which can be inited after the window is shown."""
|
||||
try:
|
||||
log.init.debug("Reading web history...")
|
||||
reader = objreg.get('web-history').async_read()
|
||||
with debug.log_time(log.init, 'Reading history'):
|
||||
while True:
|
||||
QApplication.processEvents()
|
||||
log.init.debug("Reading web history...")
|
||||
reader = objreg.get('web-history').async_read()
|
||||
with debug.log_time(log.init, 'Reading history'):
|
||||
while True:
|
||||
QApplication.processEvents()
|
||||
try:
|
||||
next(reader)
|
||||
except StopIteration:
|
||||
pass
|
||||
except (OSError, UnicodeDecodeError) as e:
|
||||
error.handle_fatal_exc(e, args, "Error while initializing!",
|
||||
pre_text="Error while initializing")
|
||||
sys.exit(usertypes.Exit.err_init)
|
||||
except StopIteration:
|
||||
break
|
||||
except (OSError, UnicodeDecodeError) as e:
|
||||
error.handle_fatal_exc(e, args, "Error while initializing!",
|
||||
pre_text="Error while initializing")
|
||||
sys.exit(usertypes.Exit.err_init)
|
||||
|
||||
|
||||
class Quitter:
|
||||
|
Loading…
Reference in New Issue
Block a user