kivy/kivy — pull request #1790 by matham (2014-01-18 23:48:30+00:00)
Title: Fix py3 gesture

This fixes https://github.com/kivy/kivy/issues/1727.

The internals work as follows: given a gesture obj, using gesture_to_str we pickle it into a StringIO object, compress with zlib, and encode into base64 to return a string. In the return direction, we take a string, decode base64, uncompress, and unpickle again using a StringIO object.

The user only handles a base64 encoded string, so whether in py3 or 2, it looks the same since it's just ascii values. So it's ok for a user to copy paste the string between py2 and py3.

The problem is that zlib compresses and decomress into bytes objects, but we pickle it with StringIO. For py2 it's not a problem because they are the same, but in py3 it's an error.

I fixed it by using a BytesIO object instead. This doesn't change what the user gets, because they get the same thing; a string it just the internal step was modified.