diff options
author | Marcelo Lira <marcelo.lira@openbossa.org> | 2011-02-16 16:36:43 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-08 16:13:55 -0300 |
commit | 75ee7ddf6ff37ed4972da02b44a77a8410e66ecd (patch) | |
tree | bcb6ed6486be280a1f3a9920854280095d9ff91e /libshiboken/conversions.h | |
parent | 2a06b872f7e3a400e03327e93570df6087d3ef0d (diff) |
SbkNumber_Check now makes use of PyNumber_Check.
Plus some provisions to handle old-style classes.
Reviewed by Bruno Araújo <bruno.araujo@openbossa.org>
Reviewed by Luciano Wolf <luciano.wolf@openbossa.org>
Diffstat (limited to 'libshiboken/conversions.h')
-rw-r--r-- | libshiboken/conversions.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libshiboken/conversions.h b/libshiboken/conversions.h index 11423ef6b..e117dbe45 100644 --- a/libshiboken/conversions.h +++ b/libshiboken/conversions.h @@ -38,7 +38,9 @@ #define PyObject_Check(X) true #include "autodecref.h" -#define SbkNumber_Check(X) (PyInt_Check(X) || PyFloat_Check(X) || PyLong_Check(X)) +// Note: if there wasn't for the old-style classes, only a PyNumber_Check would suffice. +#define SbkNumber_Check(X) \ + (PyNumber_Check(X) && (!PyInstance_Check(X) || PyObject_HasAttrString(X, "__trunc__"))) namespace Shiboken { |