[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH 1/2] python: treat flags as default argument with value 0



On 2013年03月21日 16:41, Guannan Ren wrote:
The following four functions have not changed because default arguments
have to come after positional arguments. Changing them will break the
the binding APIs.

migrate(self, dconn, flags, dname, uri, bandwidth):
migrate2(self, dconn, dxml, flags, dname, uri, bandwidth):
migrateToURI(self, duri, flags, dname, bandwidth):
migrateToURI2(self, dconnuri, miguri, dxml, flags, dname, bandwidth):

So how are they filtered? ...



---
  python/generator.py                          |  2 ++
  python/libvirt-override-virConnect.py        | 14 +++++++-------
  python/libvirt-override-virDomain.py         |  2 +-
  python/libvirt-override-virDomainSnapshot.py |  2 +-
  python/libvirt-override-virStoragePool.py    |  2 +-
  python/libvirt-override.py                   |  2 +-
  6 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/python/generator.py b/python/generator.py
index d269e88..bb53fcf 100755
--- a/python/generator.py
+++ b/python/generator.py
@@ -1487,6 +1487,8 @@ def buildWrappers(module):
                      if n != index:
                          classes.write(", %s" % arg[0])
                      n = n + 1
+                if arg[0] == "flags":
+                    classes.write("=0");

...As I see you write "flags=0" for all the automatically generated
APIs here? And is there any risk to have other APIs of which flags
doesn't default to 0? Except the ones you mentioned in commit log.


                  classes.write("):\n")
                  writeDoc(module, name, args, '        ', classes)
                  n = 0
diff --git a/python/libvirt-override-virConnect.py b/python/libvirt-override-virConnect.py
index 121ef6f..5495b70 100644
--- a/python/libvirt-override-virConnect.py
+++ b/python/libvirt-override-virConnect.py
@@ -204,7 +204,7 @@
          self.domainEventCallbackID[ret] = opaque
          return ret

-    def listAllDomains(self, flags):
+    def listAllDomains(self, flags=0):

All the left are manually created files. So it's safe.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]