[lttng-dev] [PATCH lttng-tools 3/4] Extras: Redefined PyInt_AsSsize_T to PyLong_AsSsize_t.

Jérémie Galarneau jeremie.galarneau at efficios.com
Mon Jan 14 11:45:48 EST 2013


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 <jeremie.galarneau at efficios.com>
---
 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




More information about the lttng-dev mailing list