From 75ee7ddf6ff37ed4972da02b44a77a8410e66ecd Mon Sep 17 00:00:00 2001 From: Marcelo Lira Date: Wed, 16 Feb 2011 16:36:43 -0300 Subject: SbkNumber_Check now makes use of PyNumber_Check. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plus some provisions to handle old-style classes. Reviewed by Bruno Araújo Reviewed by Luciano Wolf --- libshiboken/conversions.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'libshiboken/conversions.h') 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 { -- cgit v1.2.3