]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
samba-tool: avoid mutable Command class values
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Fri, 23 Feb 2024 03:19:02 +0000 (16:19 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 29 Feb 2024 01:31:31 +0000 (01:31 +0000)
These values are shared across all instances of the class,
which makes no difference in samba-tool itself, because there
is one instance per process. But in tests we can have many
Command classes at once (due to runcmd()), and if any of them
happened to append to takes_args or takes_options rather than
replacing it, well, the effect would be subtle.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/netcmd/__init__.py

index 7ddc1dc08289e18e74fe2e5ddb3b4b7c99c93617..54e4a207a209050b6ede63dc8519680d1e929312 100644 (file)
@@ -82,8 +82,8 @@ class Command(object):
     # synopsis must be defined in all subclasses in order to provide the
     # command usage
     synopsis = None
-    takes_args = []
-    takes_options = []
+    takes_args = ()
+    takes_options = ()
     takes_optiongroups = {}
 
     hidden = False