From patchwork Tue Sep 21 15:39:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D11473: util: eliminate the possibility of returning None from `versiontuple()` From: phabricator X-Patchwork-Id: 49791 Message-Id: To: Phabricator Cc: mercurial-devel@mercurial-scm.org Date: Tue, 21 Sep 2021 15:39:31 +0000 mharbison72 created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This fixes the following error flagged by pytype: File "/mnt/c/Users/Matt/hg/mercurial/extensions.py", line 228, in load: unsupported operand types for > [unsupported-operands] Primitive types 'Optional[tuple]' and 'curver: Optional[tuple]' are not comparable. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D11473 AFFECTED FILES mercurial/util.py CHANGE DETAILS To: mharbison72, #hg-reviewers Cc: mercurial-patches, mercurial-devel diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -1225,6 +1225,8 @@ if n == 4: return (vints[0], vints[1], vints[2], extra) + raise error.ProgrammingError(b"invalid version part request: %d" % n) + def cachefunc(func): '''cache the result of function calls'''