X-Git-Url: https://git.distorted.org.uk/~mdw/catacomb-python/blobdiff_plain/b2e2c7eef3e99fc9ad23e1b69020ff0fc722ba61..71574cbaff3942fd35ceb2754cbfc36449856644:/catacomb/__init__.py diff --git a/catacomb/__init__.py b/catacomb/__init__.py index 0e5c31c..26463b4 100644 --- a/catacomb/__init__.py +++ b/catacomb/__init__.py @@ -658,10 +658,10 @@ class _tmp: def check(me, sz): return me.min <= sz <= me.max and sz%me.mod == 0 def best(me, sz): if sz < me.min: raise ValueError('key too small') - elif sz > me.max: return me.max + elif me.max is not None and sz > me.max: return me.max else: return sz - sz%me.mod def pad(me, sz): - if sz > me.max: raise ValueError('key too large') + if me.max is not None and sz > me.max: raise ValueError('key too large') elif sz < me.min: return me.min else: sz += me.mod - 1; return sz - sz%me.mod _augment(KeySZRange, _tmp)