Skip to content

LintMiddleware not Python 3 compatible #1510

@NiklasMM

Description

@NiklasMM

Accessing a Werkzeug-Application with an active LintMiddleware raises an error:

AttributeError: 'ClosingIterator' object has no attribute 'next'

That's because this part of it is not Python 3 compatible:

class GuardedIterator(object):
def __init__(self, iterator, headers_set, chunks):
self._iterator = iterator
self._next = iter(iterator).next
self.closed = False
self.headers_set = headers_set
self.chunks = chunks

A possible fix would be to set self._next to iter(iterator).__next__ if run under Python 3.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions