diff mercurial/patch.py @ 50928:d718eddf01d9

safehasattr: drop usage in favor of hasattr The two functions should now be equivalent at least in their usage in core.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 31 Aug 2023 23:56:15 +0200
parents 886d05ed9a46
children 493034cc3265 8f629783b8ae
line wrap: on
line diff
--- a/mercurial/patch.py	Thu Dec 08 15:33:19 2022 +0100
+++ b/mercurial/patch.py	Thu Aug 31 23:56:15 2023 +0200
@@ -168,7 +168,7 @@
 
     mimeheaders = [b'content-type']
 
-    if not util.safehasattr(stream, 'next'):
+    if not hasattr(stream, 'next'):
         # http responses, for example, have readline but not next
         stream = fiter(stream)
 
@@ -1703,7 +1703,7 @@
 
     newhunks = []
     for c in hunks:
-        if util.safehasattr(c, 'reversehunk'):
+        if hasattr(c, 'reversehunk'):
             c = c.reversehunk()
         newhunks.append(c)
     return newhunks