Re: [PATCH] Add Python binding for virGetVersion

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

 



On Tue, 2007-05-29 at 12:43 +0100, Richard W.M. Jones wrote:

>  >>> libvirt.getVersion ("Xen");
> (2002, 3000001)
>  >>> libvirt.getVersion (None);
> 2002

	I don't think it's a big deal, but I was suggesting these two should be
equivalent - i.e. None == "Xen". That's why the code I posted explicitly
checked for a zero length arg list - if you used "|z" with
PyArg_ParseTuple(), you wouldn't be able[1] to distinguish between no
args and None.

	Either that, or just don't allow None as an argument at all - i.e. pass
"|s" to PyArg_ParseTuple().

Cheers,
Mark.

[1] - barring doing something ugly like:

  char *type = (char *) -1;

  parse(args, "|z", &type);

  if (type == (char *) -1)
      return libVer;
  else if (type == NULL)
      return getVer("xen");
  else
      return getVer(type);


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]