Improve error handling in objreg.dump_objects
This commit is contained in:
parent
df9bee33f4
commit
8771759f68
@ -23,7 +23,6 @@
|
|||||||
import collections
|
import collections
|
||||||
import functools
|
import functools
|
||||||
|
|
||||||
import sip
|
|
||||||
from PyQt5.QtCore import QObject, QTimer
|
from PyQt5.QtCore import QObject, QTimer
|
||||||
|
|
||||||
from qutebrowser.utils import log
|
from qutebrowser.utils import log
|
||||||
@ -144,8 +143,12 @@ class ObjectRegistry(collections.UserDict):
|
|||||||
"""Dump all objects as a list of strings."""
|
"""Dump all objects as a list of strings."""
|
||||||
lines = []
|
lines = []
|
||||||
for name, obj in self.data.items():
|
for name, obj in self.data.items():
|
||||||
if not (isinstance(obj, QObject) and sip.isdeleted(obj)):
|
try:
|
||||||
lines.append("{}: {}".format(name, repr(obj)))
|
obj_repr = repr(obj)
|
||||||
|
except (RuntimeError, TypeError):
|
||||||
|
# Underlying object deleted probably
|
||||||
|
obj_repr = '<deleted>'
|
||||||
|
lines.append("{}: {}".format(name, obj_repr))
|
||||||
return lines
|
return lines
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user