Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wsgiref.validator.InputWrapper readline method has wrong signature #48084

Closed
strogon14 mannequin opened this issue Sep 11, 2008 · 2 comments
Closed

wsgiref.validator.InputWrapper readline method has wrong signature #48084

strogon14 mannequin opened this issue Sep 11, 2008 · 2 comments
Assignees
Labels
stdlib Python modules in the Lib dir

Comments

@strogon14
Copy link
Mannequin

strogon14 mannequin commented Sep 11, 2008

BPO 3834
Nosy @pjeby

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = 'https://github.com/pjeby'
closed_at = <Date 2008-09-11.22:14:48.809>
created_at = <Date 2008-09-11.12:22:11.314>
labels = ['invalid', 'library']
title = 'wsgiref.validator.InputWrapper readline method has wrong signature'
updated_at = <Date 2008-09-11.22:14:48.808>
user = 'https://bugs.python.org/strogon14'

bugs.python.org fields:

activity = <Date 2008-09-11.22:14:48.808>
actor = 'pje'
assignee = 'pje'
closed = True
closed_date = <Date 2008-09-11.22:14:48.809>
closer = 'pje'
components = ['Library (Lib)']
creation = <Date 2008-09-11.12:22:11.314>
creator = 'strogon14'
dependencies = []
files = []
hgrepos = []
issue_num = 3834
keywords = []
message_count = 2.0
messages = ['73016', '73064']
nosy_count = 2.0
nosy_names = ['pje', 'strogon14']
pr_nums = []
priority = 'normal'
resolution = 'not a bug'
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue3834'
versions = ['Python 2.5']

@strogon14
Copy link
Mannequin Author

strogon14 mannequin commented Sep 11, 2008

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

@strogon14 strogon14 mannequin added the stdlib Python modules in the Lib dir label Sep 11, 2008
@pjeby
Copy link
Mannequin

pjeby mannequin commented Sep 11, 2008

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.

@pjeby pjeby mannequin closed this as completed Sep 11, 2008
@pjeby pjeby mannequin added the invalid label Sep 11, 2008
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir
Projects
None yet
Development

No branches or pull requests

0 participants