[PATCH evemu v2 4/4] py: make Device python 3 compatible

Benjamin Tissoires benjamin.tissoires at gmail.com
Wed Jan 15 13:47:46 PST 2014


On Wed, Jan 15, 2014 at 4:45 PM, Peter Hutterer
<peter.hutterer at who-t.net> wrote:
> On Wed, Jan 15, 2014 at 04:05:01PM -0500, Benjamin Tissoires wrote:
>> The previous commit breaks Python 3.0 support due to devnode returning
>> a bytes object.
>>
>> We could also force devnode to return an unicode string by using
>> decode, but still, the test "if type(f) == str" will fail in Python 2.X
>> because str and unicode are distinct object types.
>>
>> So, in order to avoid having to introduce bad quirks, just drop the test
>> regarding str, and let open() telling us what is wrong in case we don't
>> give it a file object.
>
> this should read "a valid path" or something, open() doesn't take the file
> object.

yeah, this is definitively not very well explained. What I meant was:
If weed don't pass a file object as an argument to Device(), then open()
will be called and tell us what is wrong.

Will change to a valid path.

> also, afaict if you swap 3 with 4 you don't break py3 compat in the
> patch set, right?

Sure, but I thought it was difficult to explain the gist of this patch
without having broken the py3 compat.
I can switch the 2 of them, but I will have to rephrase the commit message :)

>
> series: Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
>
Thanks!

Cheers,
Benjamin


More information about the Input-tools mailing list