changeset 6631:0f8dbea4458e

topic: use functools.partial() instead of using __get__ method-wrapper This was confusing to pytype (and potentially to humans reading this code), so let's use functools here. The new code might actually be more self-explanatory.
author Anton Shestakov <av6@dwimlabs.net>
date Mon, 01 Jan 2024 19:00:18 -0300
parents f2b8e94d7afb
children 7771e80a7280
files hgext3rd/topic/topicmap.py
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/topic/topicmap.py	Mon Jan 01 18:04:25 2024 -0300
+++ b/hgext3rd/topic/topicmap.py	Mon Jan 01 19:00:18 2024 -0300
@@ -1,4 +1,5 @@
 import contextlib
+import functools
 import hashlib
 
 from mercurial.i18n import _
@@ -134,7 +135,7 @@
 
         def _wrapupdatebmcachemethod(orig, self, repo):
             # pass in the bound method as the original
-            return _wrapupdatebmcache(orig.__get__(self), repo)
+            return _wrapupdatebmcache(functools.partial(orig, self), repo)
         extensions.wrapfunction(branchmap.BranchMapCache, 'updatecache', _wrapupdatebmcachemethod)
     except AttributeError:
         # hg <= 4.9 (3461814417f3)