From matusvalo at gmail.com Mon Aug 14 13:25:35 2023 From: matusvalo at gmail.com (matus valo) Date: Mon, 14 Aug 2023 19:25:35 +0200 Subject: [Cython] uvloop issue in Cython3 Message-ID: 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: From dw-git at d-woods.co.uk Mon Aug 14 13:34:40 2023 From: dw-git at d-woods.co.uk (da-woods) Date: Mon, 14 Aug 2023 18:34:40 +0100 Subject: [Cython] uvloop issue in Cython3 In-Reply-To: References: Message-ID: <859553a4-6254-9314-a814-0a1deed22894@d-woods.co.uk> 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 "", line 1, in 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: From matusvalo at gmail.com Mon Aug 14 15:06:29 2023 From: matusvalo at gmail.com (matus valo) Date: Mon, 14 Aug 2023 21:06:29 +0200 Subject: [Cython] uvloop issue in Cython3 In-Reply-To: <859553a4-6254-9314-a814-0a1deed22894@d-woods.co.uk> References: <859553a4-6254-9314-a814-0a1deed22894@d-woods.co.uk> Message-ID: Thank you David! I was not aware that method parameters are mangled in python. It seems it helped. BTW, I think that the Cython documentation is lacking this change: https://cython.readthedocs.io/en/latest/src/userguide/migrating_to_cy30.html#python-semantics Matus On Mon, 14 Aug 2023 at 19:42, da-woods wrote: > 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 "", line 1, in > 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 listcython-devel at python.orghttps://mail.python.org/mailman/listinfo/cython-devel > > > _______________________________________________ > 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: From dw-git at d-woods.co.uk Mon Aug 14 16:52:15 2023 From: dw-git at d-woods.co.uk (da-woods) Date: Mon, 14 Aug 2023 21:52:15 +0100 Subject: [Cython] uvloop issue in Cython3 In-Reply-To: References: <859553a4-6254-9314-a814-0a1deed22894@d-woods.co.uk> Message-ID: <1ae1f1e3-a2bb-9e68-c128-f137ec8b0593@d-woods.co.uk> On 14/08/2023 20:06, matus valo wrote: > > BTW, I think that the Cython documentation is lacking this change: > https://cython.readthedocs.io/en/latest/src/userguide/migrating_to_cy30.html#python-semantics There's a segment further down on "Class-private name mangling". I think if we wanted to mention it then it'd go there.? It's probably a detail we'd want to keep fairly brief I think. From stefan_ml at behnel.de Sun Aug 27 05:16:17 2023 From: stefan_ml at behnel.de (Stefan Behnel) Date: Sun, 27 Aug 2023 11:16:17 +0200 Subject: [Cython] Cython 3.0.2 released Message-ID: Hi all, Cython 3.0.2 is released. It fixes two major regressions in 3.0.1, so please upgrade if that failed for you. https://cython.readthedocs.io/en/latest/src/changes.html Have fun, Stefan