eric6/Project/ProjectBrowserModel.py

changeset 8243
cc717c2ae956
parent 8235
78e6d29eb773
child 8259
2bbec88047dd
--- a/eric6/Project/ProjectBrowserModel.py	Thu Apr 15 16:52:05 2021 +0200
+++ b/eric6/Project/ProjectBrowserModel.py	Thu Apr 15 18:11:24 2021 +0200
@@ -9,6 +9,7 @@
 
 import os
 import re
+import contextlib
 
 from PyQt5.QtCore import QDir, QModelIndex, pyqtSignal, QFileSystemWatcher, Qt
 from PyQt5.QtGui import QColor
@@ -645,15 +646,13 @@
                     else:
                         break
                 for child in itm.children():
-                    try:
+                    with contextlib.suppress(AttributeError):
                         start, end = child.boundaries()
                         if end == -1:
                             end = 1000000   # assume end of file
                         if start <= lineno <= end:
                             itm = child
                             break
-                    except AttributeError:
-                        pass
                 else:
                     itm = None
                 if itm:

eric ide

mercurial