Antoine Pitrou added the comment: I know nothing about TUN but you may simply be hitting this code path: https://github.com/spotify/linux/blob/master/drivers/net/tun.c#L601-L614
Since: >>> ('e'.encode()[0] & 0xf0) in (0x40, 0x60) True >>> ('é'.encode()[0] & 0xf0) in (0x40, 0x60) False writing 'é'.encode() will hit the EINVAL-returning path. The bottom line is that TUN devices don't seem to support free-form data, but expect a certain format. ---------- nosy: +neologix _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30430> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com