Remove asserts on str probe names
authorMark Drayton <mbd@fb.com>
Wed, 27 Jul 2016 02:08:20 +0000 (03:08 +0100)
committerMark Drayton <mbd@fb.com>
Wed, 27 Jul 2016 19:59:12 +0000 (20:59 +0100)
commit7c14842761bf04d90264712caec50e05217f4147
tree67cc199b78b9a9b5e9403501462f8507fc54963d
parent1d6a31b1d186e01154bb8135e6470c9b2180c6eb
Remove asserts on str probe names

`open_kprobes` is a dict of open kprobes. Its keys are strings for normal
probes and a tuple for perf buffers. Normal probes need unregistering on script
exit; perf buffers do not. `cleanup` currently looks for string keys
(specifically type `str`) when working out what to unregister, which is a bit
brittle -- in Python2 strings can be both native `str` and `unicode`, depending
what exactly was passed to `attach-*/detach_*` and whether `from __future__
import unicode_literals` is used (e.g. #623).

This diff makes the API more relaxed by casting the probe name to `str` to
match the expectations of `cleanup`. This works in py2 (with and without
unicode_literals) and py3.
src/python/bcc/__init__.py