Patchwork D11473: util: eliminate the possibility of returning None from `versiontuple()`

login
register
mail settings
Submitter phabricator
Date Sept. 21, 2021, 3:39 p.m.
Message ID <differential-rev-PHID-DREV-3z3pum7izrvfdkypdldt-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49791/
State Superseded
Headers show

Comments

phabricator - Sept. 21, 2021, 3:39 p.m.
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

Patch

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'''