STINNER Victor <victor.stin...@haypocalc.com> added the comment: r87996+r87997 adds encoding and errors argument to parse_qs() and parse_qsl() of urllib.parse. It is needed to decoded correctly %XX syntax in cgi.
r87998 is the patch on the cgi module. Changes with cgi_32.patch: * Use TextIOWrapper instead of TextIOBase, because TextIOBase has no buffer attribute * typo in a docstring: "it must must" => "must" * (docstring) default: sys.stdin => default: sys.stdin.buffer * PEP 8: hasattr(a,b) => hasattr(a, b) (same for isinstance) and "encoding = 'utf-8'" => "encoding='utf-8'" (in the argument list) * "xxx.decode(...) # str": remove useless # str comment. decode() always give unicode in Python 3 (same change for ".encode() # bytes") * Rename "next" variables to "next_boundary" because next is a builtin function in Python 3 (unrelated change). * FieldStorage.innerboundary and FieldStorage.outerboundary are bytes objects: encode innerboundary in the constructor, and raise an error if outerboundary is not a bytes object * Rename _use_bytes to _binary_file * isinstance(bytes) test: write the type, not the value, in the error message * Replace line[:2] == b'--' by line.startswith(b'--'), and then replace line.strip() by line.rstrip() * test_fieldstorage_multipart() uses ASCII (and specifiy the encoding to FieldStorage) * add FieldStorage.errors attribute: pass it to parse_qsl() * add errors attribute to FieldStorage: same default value than urllib.parse.unquote(): 'replace' * parse(): pass encoding argument to parse_qs() * FieldStorage: pass encoding and errors arguments to parse_qsl() Because the patch on TextIOBase, it patched the docstring: --- fp : file pointer; default: sys.stdin.buffer (not used when the request method is GET) Can be : 1. an instance of (a subclass of) TextIOWrapper, in this case it must provide an attribute "buffer" = the binary layer that returns bytes from its read() method, and preferably an attribute "encoding" (defaults to latin-1) 2. an object whose read() and readline() methods return bytes --- becomes --- fp : file pointer; default: sys.stdin.buffer (not used when the request method is GET) Can be : 1. a TextIOWrapper object 2. an object whose read() and readline() methods return bytes --- Replace "type(value) is type([])" is done in another commit: r87999. I consider that the work on this issue is done, and so I close it. If I am wrong, explain why and repoen the issue. Please test the cgi as much as possible before Python 3.2 final: reopen the issue if it doesn't work. ---------- resolution: -> fixed status: open -> closed _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue4953> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com