Submitter | phabricator |
---|---|
Date | Nov. 14, 2019, 9:12 p.m. |
Message ID | <differential-rev-PHID-DREV-igfgmlefe6jtfrvb654i-req@mercurial-scm.org> |
Download | mbox | patch |
Permalink | /patch/43215/ |
State | Superseded |
Headers | show |
Comments
dlax added inline comments. dlax accepted this revision. INLINE COMMENTS > extensions.py:96 > + # pytype seems to think `fd` is a str, but I'm pretty sure > + # it's wrong. This may be a bug we need to report upstream. > + return imp.load_module( the doc indeed says that "fd" is file object REPOSITORY rHG Mercurial CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D7410/new/ REVISION DETAIL https://phab.mercurial-scm.org/D7410 To: durin42, #hg-reviewers, dlax Cc: dlax, mercurial-devel
dlax added inline comments. INLINE COMMENTS > dlax wrote in extensions.py:96 > the doc indeed says that "fd" is file object In https://github.com/python/typeshed/blob/master/stdlib/3/imp.pyi type of `find_module` seems wrong. REPOSITORY rHG Mercurial CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D7410/new/ REVISION DETAIL https://phab.mercurial-scm.org/D7410 To: durin42, #hg-reviewers, dlax Cc: dlax, mercurial-devel
dlax added a comment. dlax accepted this revision. meanwhile, https://github.com/python/typeshed/pull/3465 REPOSITORY rHG Mercurial CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D7410/new/ REVISION DETAIL https://phab.mercurial-scm.org/D7410 To: durin42, #hg-reviewers, dlax Cc: dlax, mercurial-devel
Patch
diff --git a/mercurial/extensions.py b/mercurial/extensions.py --- a/mercurial/extensions.py +++ b/mercurial/extensions.py @@ -92,7 +92,11 @@ # module/__init__.py style d, f = os.path.split(path) fd, fpath, desc = imp.find_module(f, [d]) - return imp.load_module(module_name, fd, fpath, desc) + # pytype seems to think `fd` is a str, but I'm pretty sure + # it's wrong. This may be a bug we need to report upstream. + return imp.load_module( + module_name, fd, fpath, desc # pytype: disable=wrong-arg-types + ) else: try: return imp.load_source(module_name, path)