summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2011-04-04 12:48:02 +0100
committerRichard W.M. Jones <rjones@redhat.com>2011-04-11 11:08:32 +0100
commit7ef60bb65dbed22be567166fc97dffdd0d0e97e6 (patch)
treede550c26ac81c44782b9e87e9b2e2b16df492fa1
parent2e4669d6e7053b0347b265d4f330e8873525bd3e (diff)
downloadlibguestfs-7ef60bb65dbed22be567166fc97dffdd0d0e97e6.tar.gz
libguestfs-7ef60bb65dbed22be567166fc97dffdd0d0e97e6.tar.xz
libguestfs-7ef60bb65dbed22be567166fc97dffdd0d0e97e6.zip
python: Convert any iterable argument to a list (RHBZ#693324).
Thanks to Erez Shinan. (cherry picked from commit afa17809599f3ebc82c3feef025ca812fb26c9fe)
-rw-r--r--generator/generator_python.ml14
1 files changed, 13 insertions, 1 deletions
diff --git a/generator/generator_python.ml b/generator/generator_python.ml
index 937c092d..9514e4ad 100644
--- a/generator/generator_python.ml
+++ b/generator/generator_python.ml
@@ -1,5 +1,5 @@
(* libguestfs
- * Copyright (C) 2009-2010 Red Hat Inc.
+ * Copyright (C) 2009-2011 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -647,6 +647,18 @@ class GuestFS:
let doc = String.concat "\n " doc in
pr " u\"\"\"%s\"\"\"\n" doc;
);
+ (* Callers might pass in iterables instead of plain lists;
+ * convert those to plain lists because the C side of things
+ * cannot deal with iterables. (RHBZ#693306).
+ *)
+ List.iter (
+ function
+ | Pathname _ | Device _ | Dev_or_Path _ | String _ | Key _
+ | FileIn _ | FileOut _ | OptString _ | Bool _ | Int _ | Int64 _
+ | BufferIn _ | Pointer _ -> ()
+ | StringList n | DeviceList n ->
+ pr " %s = list (%s)\n" n n
+ ) args;
pr " return libguestfsmod.%s (self._o" name;
List.iter (fun arg -> pr ", %s" (name_of_argt arg)) (args@optargs);
pr ")\n\n";