# HG changeset patch # User Matt Harbison # Date 2021-09-20 15:05:30 # Node ID 376d08ae904fc7ec088404b0ac16921dab361554 # Parent 406a7e62994674e4292ef5b49d8d60e612e15675 util: eliminate the possibility of returning None from `versiontuple()` 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. Differential Revision: https://phab.mercurial-scm.org/D11473 diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -1225,6 +1225,8 @@ def versiontuple(v=None, n=4): 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'''