forked from pool/python-celery
- Replace no-async.patch with three Python 3.7 patches merged upstream python37-1.patch, python37-2.patch & python37-3.patch - Replace sed invocation with unpin-pytest.patch for clarity OBS-URL: https://build.opensuse.org/request/show/677998 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-celery?expand=0&rev=114
29 lines
1.2 KiB
Diff
29 lines
1.2 KiB
Diff
From 6ab775eb6b5643311af21557fa84d10ce605eb17 Mon Sep 17 00:00:00 2001
|
|
From: Omer Katz <omer.drow@gmail.com>
|
|
Date: Fri, 4 Jan 2019 07:12:10 +0200
|
|
Subject: [PATCH] Avoid raising StopIterator in generators. (#5263)
|
|
|
|
According to [PEP-479](https://www.python.org/dev/peps/pep-0479/) StopIteration should not be used any more to indicate the termination of a generator.
|
|
Starting from Python 3.7 this behaviour is always enforced and a RuntimeError is raised instead.
|
|
Instead of raising a StopIterator exception, we now never execute our yield statement.
|
|
Since it is present Gen is still a generator but it will never yield any value.
|
|
---
|
|
t/unit/worker/test_loops.py | 4 ++--
|
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/t/unit/worker/test_loops.py b/t/unit/worker/test_loops.py
|
|
index f86f730f16..d57b416e47 100644
|
|
--- a/t/unit/worker/test_loops.py
|
|
+++ b/t/unit/worker/test_loops.py
|
|
@@ -383,8 +383,8 @@ def test_poll_write_generator_stopped(self):
|
|
x = X(self.app)
|
|
|
|
def Gen():
|
|
- raise StopIteration()
|
|
- yield
|
|
+ if 0:
|
|
+ yield
|
|
gen = Gen()
|
|
x.hub.add_writer(6, gen)
|
|
x.hub.on_tick.add(x.close_then_error(Mock(name='tick'), 2))
|