diff --git a/Doc/library/csv.rst b/Doc/library/csv.rst index 80ddaad947f..46ef246b390 100644 --- a/Doc/library/csv.rst +++ b/Doc/library/csv.rst @@ -351,15 +351,14 @@ Reader Objects Reader objects (:class:`DictReader` instances and objects returned by the :func:`reader` function) have the following public methods: - -.. method:: csvreader.next() +.. method:: csvreader.__next__() Return the next row of the reader's iterable object as a list, parsed according - to the current dialect. + to the current dialect. Usually you should call this as ``next(reader)``. + Reader objects have the following public attributes: - .. attribute:: csvreader.dialect A read-only description of the dialect in use by the parser. @@ -371,10 +370,8 @@ Reader objects have the following public attributes: number of records returned, as records can span multiple lines. - DictReader objects have the following public attribute: - .. attribute:: csvreader.fieldnames If not passed as a parameter when creating the object, this attribute is diff --git a/Lib/test/test_xmlrpc.py b/Lib/test/test_xmlrpc.py index d1ed40fa29e..1f5f5aa4f3c 100644 --- a/Lib/test/test_xmlrpc.py +++ b/Lib/test/test_xmlrpc.py @@ -598,7 +598,11 @@ def test_cgi_xmlrpc_response(self): sys.stdin = open("xmldata.txt", "r") sys.stdout = open(support.TESTFN, "w") - self.cgi.handle_request() + os.environ['CONTENT_LENGTH'] = str(len(data)) + try: + self.cgi.handle_request() + finally: + del os.environ['CONTENT_LENGTH'] sys.stdin.close() sys.stdout.close() diff --git a/Lib/xmlrpc/server.py b/Lib/xmlrpc/server.py index eb807c484b7..ea828a52e98 100644 --- a/Lib/xmlrpc/server.py +++ b/Lib/xmlrpc/server.py @@ -590,7 +590,7 @@ def handle_request(self, request_text = None): # POST data is normally available through stdin try: length = int(os.environ.get('CONTENT_LENGTH', None)) - except ValueError: + except (ValueError, TypeError): length = -1 if request_text is None: request_text = sys.stdin.read(length)