aboutsummaryrefslogtreecommitdiffstats
path: root/libshiboken
diff options
context:
space:
mode:
Diffstat (limited to 'libshiboken')
-rw-r--r--libshiboken/conversions.h4
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
{