fixed python3 compatibility
This commit is contained in:
1 parent
20416b4d1c
commit
1a169b340e
1 file changed
+5
-1
+5
-1
@@ -121,7 +121,11 @@ def console(version):
|
|||||||
def __call__(self, parser, namespace, values, option_string=None):
|
def __call__(self, parser, namespace, values, option_string=None):
|
||||||
if isinstance(values, list):
|
if isinstance(values, list):
|
||||||
# must copy to avoid altering the option default value
|
# must copy to avoid altering the option default value
|
||||||
items = argparse._ensure_value(namespace, self.dest, [])[:]
|
value = getattr(namespace, self.dest, None)
|
||||||
|
if value is None:
|
||||||
|
value = []
|
||||||
|
setattr(namespace, self.dest, value)
|
||||||
|
items = value[:]
|
||||||
# for options that allows multiple args (i.e. those declared
|
# for options that allows multiple args (i.e. those declared
|
||||||
# with add_argument(..., nargs='+', ...)) the values are
|
# with add_argument(..., nargs='+', ...)) the values are
|
||||||
# always placed into a list
|
# always placed into a list
|
||||||
|
|||||||
Reference in new issue
Block a user