Bug#959030: python3-libproxy: outputs quoted Python bytes literals instead of plain strings

Simon McVittie smcv at debian.org
Tue Apr 28 10:21:53 BST 2020


Package: python3-libproxy
Version: 0.4.15-9
Severity: important
Tags: upstream

$ cat debian/tests/resolve-proxy.py
#!/usr/bin/python3

import libproxy
import sys

if __name__ == '__main__':
    factory = libproxy.ProxyFactory()

    for url in sys.argv[1:]:
        print(' '.join(factory.getProxies(url)))
$ ./debian/tests/resolve-proxy.py http://google.com

Expected result: direct://

Actual result: b'direct://'

factory.getProxies() is correctly returning a sequence of str, but each
str takes the form "b'direct://'", indicating that a bytes object was
incorrectly converted into a (Unicode) string.

https://github.com/libproxy/libproxy/issues/65 seems to be related, but
a comment on https://github.com/libproxy/libproxy/pull/66 indicates that
it was probably not a complete solution:

    Looks like you're not taking IDN into account. This will make things
    worse by creating mojibake, Python exceptions and/or invalid URLs.

(#65/#66 both happened since the most recent upstream release.)

    smcv



More information about the pkg-gnome-maintainers mailing list