Control: tags 1101258 patch

This is actually caused by a test that makes assumsations about the
builtin python asyncio event loops that no longer hold.

python upstream commit 
https://github.com/python/cpython/commit/38a99568763604ccec5d5027f0658100ad76876f
semi-silently moved the responsibity for managing a task name from
create_task method to the __init__ of the Task class.

This 3.14 change was backported upstream to 3.13 in

https://github.com/python/cpython/commit/7b0543ebe649aea11531e994289293f23f41064e

The tests in uvloop fail with the new behavior. 

The uvloop test suite runs the tests once using the uvloop implementation
(which succeeds) and once (likely as validation) against python's asyncio
implementation. The later run fails.

Thus this not a problem in the uvloop code. One way would be to disable
the test.

But it is also possible to work around the test problem by changing the
test to handle the chance only in the non uvloop case as this:


--- uvloop-0.21.0+ds1.orig/tests/test_base.py
+++ uvloop-0.21.0+ds1/tests/test_base.py
@@ -576,9 +576,14 @@ class _TestBase:
         async def coro():
             pass
 
-        factory = lambda loop, coro, **kwargs: MyTask(
-            coro, loop=loop, **kwargs
-        )
+        def factory(loop, coro, **kwargs):
+            task = MyTask(coro, loop=loop, **kwargs)
+            # python moved the responsibility to set the name to the Task 
class constructor,
+            # so MyTask.set_name is never called by python's create_task.
+            # Compensate for that here
+            if self.is_asyncio_loop():
+                task.set_name(kwargs['name'])
+            return task
 
         self.assertIsNone(self.loop.get_task_factory())
         task = self.loop.create_task(coro(), name="mytask")


I hope some one can prepare a upload which either disables the test or with
a patch that fixes the test in the case it run with the python event loop.

Regards,
 - Martin Hostettler

Reply via email to