On Mon, Dec 9, 2013 at 9:15 AM, Daniel P. Berrange <berra...@redhat.com> wrote:
> From: "Daniel P. Berrange" <berra...@redhat.com>
>
> The PyString and PyInt classes are gone in Python 3, so we must
> conditionalize their use to be Python 2 only.
>
> Signed-off-by: Daniel P. Berrange <berra...@redhat.com>
> ---
>  libvirt-override.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/libvirt-override.c b/libvirt-override.c
> index 9a013ca..77c0af2 100644
> --- a/libvirt-override.c
> +++ b/libvirt-override.c
> @@ -322,7 +322,11 @@ virPyDictToTypedParams(PyObject *dict,
>          }
>
>          if (type == -1) {
> +#if PY_MAJOR_VERSION > 2
> +            if (PyUnicode_Check(value)) {
> +#else
>              if (PyString_Check(value)) {
> +#endif
>                  type = VIR_TYPED_PARAM_STRING;
>              } else if (PyBool_Check(value)) {
>                  type = VIR_TYPED_PARAM_BOOLEAN;
> @@ -332,11 +336,13 @@ virPyDictToTypedParams(PyObject *dict,
>                      type = VIR_TYPED_PARAM_LLONG;
>                  else
>                      type = VIR_TYPED_PARAM_ULLONG;
> +#if PY_MAJOR_VERSION == 2

Every where else in your other patches you did PY_MAJOR_VERSION < 3,
but its not like we're going to support Python 1 but just a note on
inconsistency.

>              } else if (PyInt_Check(value)) {
>                  if (PyInt_AS_LONG(value) < 0)
>                      type = VIR_TYPED_PARAM_LLONG;
>                  else
>                      type = VIR_TYPED_PARAM_ULLONG;
> +#endif
>              } else if (PyFloat_Check(value)) {
>                  type = VIR_TYPED_PARAM_DOUBLE;
>              }
> --
> 1.8.3.1
>
> --
> libvir-list mailing list
> libvir-list@redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list

ACK.

-- 
Doug Goldstein

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to