From: Yehuda Sadeh Date: Tue, 25 May 2021 21:54:11 +0000 (-0700) Subject: pybind/argparse: handle None sequence X-Git-Tag: v17.1.0~340^2~10 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f64754a89894fa40f34570c15dd1cd2afcbfdbfa;p=ceph.git pybind/argparse: handle None sequence Signed-off-by: Yehuda Sadeh --- diff --git a/src/pybind/ceph_argparse.py b/src/pybind/ceph_argparse.py index d24b8f8daa49..b4aace3dfb80 100644 --- a/src/pybind/ceph_argparse.py +++ b/src/pybind/ceph_argparse.py @@ -218,6 +218,8 @@ class CephArgtype(object): orig_type = get_origin(tp) type_args = get_args(tp) if orig_type in (abc.Sequence, Sequence, List, list): + if v is None: + return None return [CephArgtype.cast_to(type_args[0], e) for e in v] elif orig_type is Tuple: return tuple(CephArgtype.cast_to(type_args[0], e) for e in v)