psykoyiko/pycanberra — pull request #2 by bochecha (2012-12-02 05:09:33+00:00)
Title: Make pycanberra work with both Python 2 and 3

The first commit is just clean up, it removes something that already wasn't needed in Python 2. However, from unneeded in Python 2, it becomes problematic in Python 3, so it should be dropped.

The second commit makes pycanberra work on Python 3, using the [six](http://pypi.python.org/pypi/six) library to keep it compatible with Python 2.

The issue is on strings defined as `"foo"` which were byte strings in Python 2 but became unicode strings in Python 3.

The underlying C libcanberra doesn't accept unicode strings, so they all must be byte strings.

However, defining them with `b"foo"` would break them on Python 2, so I used `six.b("foo")` instead.

If the dependency on `six` is an issue, then we could just copy-paste the code for `six.b` in pycanberra. (but code duplication is bad, so I preferred using the module as a dependency in the first submission :wink:)