usdt: convert text from bytes to str
authorRafael Fonseca <rdossant@redhat.com>
Fri, 10 Feb 2017 12:50:13 +0000 (13:50 +0100)
committerRafael Fonseca <rdossant@redhat.com>
Fri, 10 Feb 2017 12:53:59 +0000 (13:53 +0100)
This fixes a TypeError in python 3, e.g, when executing uobjnew

Traceback (most recent call last):
  File "./uobjnew", line 134, in <module>
    bpf = BPF(text=program, usdt_contexts=[usdt])
  File "/usr/lib/python3.5/site-packages/bcc/__init__.py", line 224, in __init__
    text = usdt_text + text
TypeError: can't concat bytes to str

src/python/bcc/usdt.py

index 19a3a98..a5278f3 100644 (file)
@@ -128,7 +128,7 @@ class USDT(object):
                             probe)
 
     def get_text(self):
-        return lib.bcc_usdt_genargs(self.context)
+        return lib.bcc_usdt_genargs(self.context).decode()
 
     def get_probe_arg_ctype(self, probe_name, arg_index):
         return lib.bcc_usdt_get_probe_argctype(