[Cython] uvloop issue in Cython3

da-woods dw-git at d-woods.co.uk
Mon Aug 14 13:34:40 EDT 2023


Hi Matus,

This'll be related to 
https://github.com/cython/cython/commit/abeb082098c13e243a2e2658f9eb45f1c151b091

Just an example (in Python, not Cython, but the Cython behaviour should 
now be the same):

>>>  class C:
...   def f(self, __kwd):
...     print(locals())
...
 >>> C().f(1)
{'self': <__main__.C object at 0x7f299ef878d0>, '_C__kwd': 1}
>>>  C().f(__kwd=1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: C.f() got an unexpected keyword argument '__kwd'
>>>  C().f(_C__kwd=1)
{'self': <__main__.C object at 0x7f299ef878d0>, '_C__kwd': 1}


I haven't looked in much detail at exactly what's happening in uvloop, 
but I think this is likely the correct (i.e. Python) behaviour that 
you're seeing.

Hopefully that's enough to track it down.

David

On 14/08/2023 18:25, matus valo wrote:
> Hi All,
>
> I was recently migrating uvloop to cython3 [1]. Unfortunately, after 
> switching to cython3, uvloop testsuite fails [2]. I am puzzled mainly 
> about following error:
>
> ======================================================================
> ERROR: test_process_delayed_stdio__paused__no_stdin 
> (test_process.Test_UV_Process_Delayed)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File "/home/runner/work/uvloop/uvloop/tests/test_process.py", line 
> 938, in test_process_delayed_stdio__paused__no_stdin
>     __uvloop_sleep_after_fork=True))
>   File "uvloop/loop.pyx", line 1517, in 
> uvloop.loop.Loop.run_until_complete
>     return future.result()
>   File "/home/runner/work/uvloop/uvloop/tests/test_process.py", line 
> 911, in run_sub
>     **kwargs)
>   File "uvloop/loop.pyx", line 2808, in subprocess_shell
>     return await self.__subprocess_run(protocol_factory, args, shell=True,
>   File "uvloop/loop.pyx", line 2734, in 
> uvloop.loop.Loop._Loop__subprocess_run
>     @cython.iterable_coroutine
> TypeError: _Loop__subprocess_run() got an unexpected keyword argument 
> '__uvloop_sleep_after_fork'
>
> ======================================================================
> ERROR: test_process_delayed_stdio__paused__stdin_pipe 
> (test_process.Test_UV_Process_Delayed)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File "/home/runner/work/uvloop/uvloop/tests/test_process.py", line 
> 919, in test_process_delayed_stdio__paused__stdin_pipe
>     __uvloop_sleep_after_fork=True))
>   File "uvloop/loop.pyx", line 1517, in 
> uvloop.loop.Loop.run_until_complete
>     return future.result()
>   File "/home/runner/work/uvloop/uvloop/tests/test_process.py", line 
> 911, in run_sub
>     **kwargs)
>   File "uvloop/loop.pyx", line 2808, in subprocess_shell
>     return await self.__subprocess_run(protocol_factory, args, shell=True,
>   File "uvloop/loop.pyx", line 2734, in 
> uvloop.loop.Loop._Loop__subprocess_run
>     @cython.iterable_coroutine
> TypeError: _Loop__subprocess_run() got an unexpected keyword argument 
> '__uvloop_sleep_after_fork'
>
> The issue is regarding calling this method: 
> https://github.com/MagicStack/uvloop/blob/1dd40f17f3b0d37e3779b6ad5041bab335142337/uvloop/loop.pyx#L2735-L2753
>
> When the same code base is compiled in Cython 0.29.X and the test 
> suite is run, there is no such error. I tried to create a simple 
> reproducer but failed.
>
> What do you think? Is it regression in Cython 3.0? Do you have any 
> hint where the root cause can be? If everything fails, I will try to 
> bisect the issue.
>
> Matus
>
>
> [1] https://github.com/MagicStack/uvloop/pull/534
> [2] https://github.com/MagicStack/uvloop/pull/534/checks
>
> _______________________________________________
> cython-devel mailing list
> cython-devel at python.org
> https://mail.python.org/mailman/listinfo/cython-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/cython-devel/attachments/20230814/5a75855c/attachment-0001.html>


More information about the cython-devel mailing list