diff options
author | jhance <jhance@users.noreply.github.com> | 2020-06-03 16:23:20 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-03 21:23:20 +0100 |
commit | 11fec3e77f3212494f8f83052168c1e71ddbf0a4 (patch) | |
tree | fe480a575ae80e75346471b20af61ec8b4aeb723 | |
parent | 93602a320c2f115a3fcad69f9b6e62fc8a99ad88 (diff) | |
download | paste-git-11fec3e77f3212494f8f83052168c1e71ddbf0a4.tar.gz |
Make next handling in wsgilib more py3-compatible (#53)
If the app-iterator being passed in is not defining `next()` (e.g. running under py3 and only defined `__next__`), this will currently crash.
Fix by using `six.next` which will use `__next__` or `next` as appropriate.
-rw-r--r-- | paste/wsgilib.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/paste/wsgilib.py b/paste/wsgilib.py index 7993f29..ae472a0 100644 --- a/paste/wsgilib.py +++ b/paste/wsgilib.py @@ -119,10 +119,10 @@ class chained_app_iters(object): def next(self): if len(self.chained) == 1: - return self.chained[0].next() + return six.next(self.chained[0]) else: try: - return self.chained[0].next() + return six.next(self.chained[0]) except StopIteration: self.chained.pop(0) return self.next() @@ -261,7 +261,7 @@ class _wrap_app_iter_app(object): def next(self): try: - return self.app_iter.next() + return six.next(self.app_iter) except StopIteration: if self.ok_callback: self.ok_callback() @@ -278,7 +278,7 @@ class _wrap_app_iter_app(object): app_iter = iter(new_app_iterable) if hasattr(new_app_iterable, 'close'): self.close = new_app_iterable.close - self.next = app_iter.next + self.next = lambda: six.next(app_iter) return self.next() __next__ = next |