Good afternoon. I'm in the Google Python Sprint working on getting the test_xmlrpc unittest to pass. The following patch was prepared by Jacques Frechet and me. We'd appreciate feedback on the attached patch.
What was broken: 1. BaseHTTPServer attempts to parse the http headers with an rfc822.Message class. This was changed in r56905 by Jeremy Hylton to use the new io library instead of stringio as before. Unfortunately Jeremy's change resulted in TextIOWrapper stealing part of the HTTP request body, due to its buffering quantum. This was not seen in normal tests because GET requests have no body, but xmlrpc uses POSTs. We fixed this by doing the equivalent of what was done before, but using io.StringIO instead of the old cStringIO class: we pull out just the header using a sequence of readlines. 2. Once this was fixed, a second error asserted: test_xmlrpc.test_with{_no,}_info call .get on the headers object from xmlrpclib.ProtocolError. This fails because the headers object became a list in r57194. The story behind this is somewhat complicated: - xmlrpclib used to use httplib.HTTP, which is old and deprecated - r57024 Jeremy Hylton switched py3k to use more modern httplib infrastructure, but broke xmlrpclib.Transport.request; the "headers" variable was now referenced without being set - r57194 Hyeshik Chang fixed xmlrpclib.Transport.request to get the headers in a way that didn't explode; unfortunately, it now returned a list instead of a dict, but there were no tests to catch this - r57221 Guido integrated xmlrpc changes from the trunk, including r57158, which added tests that relied on headers being a dict. Unfortunately, it no longer was. 3. test_xmlrpc.test_fail_with_info was failing because the ValueError string of int('nonintegralstring') in py3k currently has an "s". This is presumably going away soon; the test now uses a regular expression with an optional leading "s", which is a little silly, but r56209 is prior art. >>> int('z') Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: invalid literal for int() with base 10: s'z'
xmlrpc.patch
Description: Binary data
_______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com