File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -544,19 +544,21 @@ def convert(
544544 import operator
545545
546546 rv = super ().convert (value , param , ctx )
547- lt_min : bool = self .min is not None and (
547+ min = self .min
548+ max = self .max
549+ lt_min : bool = min is not None and (
548550 operator .le if self .min_open else operator .lt
549- )(rv , self . min ) # type: ignore[arg-type]
550- gt_max : bool = self . max is not None and (
551+ )(rv , min ) # type: ignore[arg-type]
552+ gt_max : bool = max is not None and (
551553 operator .ge if self .max_open else operator .gt
552- )(rv , self . max ) # type: ignore[arg-type]
554+ )(rv , max ) # type: ignore[arg-type]
553555
554556 if self .clamp :
555- if lt_min :
556- return self ._clamp (self . min , 1 , self .min_open ) # type: ignore
557+ if min is not None and lt_min :
558+ return self ._clamp (min , 1 , self .min_open ) # type: ignore[arg-type]
557559
558- if gt_max :
559- return self ._clamp (self . max , - 1 , self .max_open ) # type: ignore
560+ if max is not None and gt_max :
561+ return self ._clamp (max , - 1 , self .max_open ) # type: ignore[arg-type]
560562
561563 if lt_min or gt_max :
562564 self .fail (
You can’t perform that action at this time.
0 commit comments