@@ -249,6 +249,7 @@ def getopt(self, args: Sequence[str] | None = None, object=None): # noqa: C901
249249 raise DistutilsArgError (msg )
250250
251251 for opt , val in opts :
252+ value : int | str = val
252253 if len (opt ) == 2 and opt [0 ] == '-' : # it's a short option
253254 opt = self .short2long [opt [1 ]]
254255 else :
@@ -260,21 +261,21 @@ def getopt(self, args: Sequence[str] | None = None, object=None): # noqa: C901
260261 opt = alias
261262
262263 if not self .takes_arg [opt ]: # boolean option?
263- assert val == '' , "boolean option can't have value"
264+ assert value == '' , "boolean option can't have value"
264265 alias = self .negative_alias .get (opt )
265266 if alias :
266267 opt = alias
267- val = 0
268+ value = 0
268269 else :
269- val = 1
270+ value = 1
270271
271272 attr = self .attr_name [opt ]
272273 # The only repeating option at the moment is 'verbose'.
273274 # It has a negative option -q quiet, which should set verbose = False.
274- if val and self .repeat .get (attr ) is not None :
275- val = getattr (object , attr , 0 ) + 1
276- setattr (object , attr , val )
277- self .option_order .append ((opt , val ))
275+ if value and self .repeat .get (attr ) is not None :
276+ value = getattr (object , attr , 0 ) + 1
277+ setattr (object , attr , value )
278+ self .option_order .append ((opt , value ))
278279
279280 # for opts
280281 if created_object :
0 commit comments