mercurial/scmutil.py
changeset 50928 d718eddf01d9
parent 50919 b3174be5e7f7
child 50929 18c8c18993f0
--- a/mercurial/scmutil.py	Thu Dec 08 15:33:19 2022 +0100
+++ b/mercurial/scmutil.py	Thu Aug 31 23:56:15 2023 +0200
@@ -233,11 +233,7 @@
             reason = encoding.unitolocal(reason)
         ui.error(_(b"abort: error: %s\n") % stringutil.forcebytestr(reason))
     except (IOError, OSError) as inst:
-        if (
-            util.safehasattr(inst, "args")
-            and inst.args
-            and inst.args[0] == errno.EPIPE
-        ):
+        if hasattr(inst, "args") and inst.args and inst.args[0] == errno.EPIPE:
             pass
         elif getattr(inst, "strerror", None):  # common IOError or OSError
             if getattr(inst, "filename", None) is not None:
@@ -561,11 +557,11 @@
             if cache is not None:
                 nodetree = cache.get(b'disambiguationnodetree')
             if not nodetree:
-                if util.safehasattr(parsers, 'nodetree'):
+                if hasattr(parsers, 'nodetree'):
                     # The CExt is the only implementation to provide a nodetree
                     # class so far.
                     index = cl.index
-                    if util.safehasattr(index, 'get_cindex'):
+                    if hasattr(index, 'get_cindex'):
                         # the rust wrapped need to give access to its internal index
                         index = index.get_cindex()
                     nodetree = parsers.nodetree(index, len(revs))
@@ -1066,7 +1062,7 @@
         return
 
     # translate mapping's other forms
-    if not util.safehasattr(replacements, 'items'):
+    if not hasattr(replacements, 'items'):
         replacements = {(n,): () for n in replacements}
     else:
         # upgrading non tuple "source" to tuple ones for BC