This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: wsgiref.validator.InputWrapper readline method has wrong signature
Type: Stage:
Components: Library (Lib) Versions: Python 2.5
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: pje Nosy List: pje, strogon14
Priority: normal Keywords:

Created on 2008-09-11 12:22 by strogon14, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg73016 - (view) Author: Christopher Arndt (strogon14) Date: 2008-09-11 12:22
The readline method in the InputWrapper class in wsgiref.validate does
not  accept any arguments and therefore is not compatible with the
"file-like" interface, where the readline method accepts an optional
"size" argument. 

This breaks code that wraps file objects with their own wrapper class
and tries to call the readline method of the wrapped object with a
"size" argument.

Current code::

    def readline(self):
        v = self.input.readline()
        assert_(type(v) is type(""))
        return v


Should be::

    def readline(self, *args):
        v = self.input.readline(*args)
        assert_(type(v) is type(""))
        return v
msg73064 - (view) Author: PJ Eby (pje) * (Python committer) Date: 2008-09-11 22:14
Per PEP 333:

"""The optional "size" argument to readline() is not supported, as it
may be complex for server authors to implement, and is not often used in
practice."""

The whole point of this code is to catch broken programs that pass an
argument to readline() -- they are not WSGI-compliant.
History
Date User Action Args
2022-04-11 14:56:39adminsetgithub: 48084
2008-09-11 22:14:48pjesetstatus: open -> closed
resolution: not a bug
messages: + msg73064
2008-09-11 21:58:53benjamin.petersonsetassignee: pje
nosy: + pje
2008-09-11 12:22:11strogon14create