eric6/WebBrowser/History/HistoryModel.py

changeset 8243
cc717c2ae956
parent 8227
349308e84eeb
--- a/eric6/WebBrowser/History/HistoryModel.py	Thu Apr 15 16:52:05 2021 +0200
+++ b/eric6/WebBrowser/History/HistoryModel.py	Thu Apr 15 18:11:24 2021 +0200
@@ -7,6 +7,8 @@
 Module implementing the history model.
 """
 
+import contextlib
+
 from PyQt5.QtCore import Qt, QAbstractTableModel, QModelIndex, QUrl
 
 import WebBrowser.WebBrowserWindow
@@ -84,10 +86,8 @@
             orientation == Qt.Orientation.Horizontal and
             role == Qt.ItemDataRole.DisplayRole
         ):
-            try:
+            with contextlib.suppress(IndexError):
                 return self.__headers[section]
-            except IndexError:
-                pass
         return QAbstractTableModel.headerData(self, section, orientation, role)
     
     def data(self, index, role=Qt.ItemDataRole.DisplayRole):

eric ide

mercurial