Python 3 merges PyInt and PyLong types. This fixes the
undefined symbol error encountered when using the bindings
with Python 3.

Signed-off-by: Jérémie Galarneau <[email protected]>
---
 extras/bindings/swig/python/lttng.i.in | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/extras/bindings/swig/python/lttng.i.in 
b/extras/bindings/swig/python/lttng.i.in
index 0d6d1e9..244bc22 100644
--- a/extras/bindings/swig/python/lttng.i.in
+++ b/extras/bindings/swig/python/lttng.i.in
@@ -15,6 +15,14 @@ multiple concurrent processes and threads. Tracing across 
multiple systems is al
 #include <lttng/lttng.h>
 %}
 
+%{
+#if PY_MAJOR_VERSION >= 3
+// The PyInt and PyLong types were unified as of Python 3
+// This makes the typemap code useable with both Python 2 and 3.
+#define PyInt_AsSsize_t PyLong_AsSsize_t
+#endif
+%}
+
 typedef unsigned int uint32_t;
 typedef int int32_t;
 typedef unsigned long long uint64_t;
-- 
1.8.1


_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

Reply via email to