Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates for Cython3 #587

Merged
merged 17 commits into from
Aug 28, 2024
Merged

Updates for Cython3 #587

merged 17 commits into from
Aug 28, 2024

Conversation

alan-brooks
Copy link
Contributor

@alan-brooks alan-brooks commented Dec 28, 2023

Remove SSL depreciation warnings
buillt on debian 12.6 python-3.11 Cython-3.0.7 libuv-1.46.0

gentoo-bot pushed a commit to gentoo/gentoo that referenced this pull request Jan 14, 2024
Bug: MagicStack/uvloop#586
Bug: MagicStack/uvloop#587
Signed-off-by: Sam James <sam@gentoo.org>
@jameshilliard
Copy link

@fantix Think you could take a look at this?

@kloczek
Copy link

kloczek commented Mar 17, 2024

Looks like dependencies have not been updated

+ /usr/bin/python3 -sBm build -w --no-isolation
* Getting build dependencies for wheel...

ERROR Missing dependencies:
        Cython<0.30.0,>=0.29.36

With below patch

--- a/pyproject.toml
+++ b/pyproject.toml
@@ -43,7 +43,7 @@
     'pycodestyle~=2.9.0',
     'pyOpenSSL~=23.0.0',
     'mypy>=0.800',
-    'Cython(>=0.29.36,<0.30.0)',
+    'Cython(>=0.29.36)',
 ]
 docs = [
     'Sphinx~=4.1.2',
@@ -55,7 +55,7 @@
 requires = [
     "setuptools>=60",
     "wheel",
-    "Cython(>=0.29.36,<0.30.0)",
+    "Cython(>=0.29.36)",
 ]
 build-backend = "setuptools.build_meta"

I was able to build uvloop however pytest fails in few units

Here is pytest output:
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-uvloop-0.19.0-2.fc36.x86_64/usr/lib64/python3.9/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-uvloop-0.19.0-2.fc36.x86_64/usr/lib/python3.9/site-packages
+ /usr/bin/pytest -ra -m 'not network' --import-mode importlib
==================================================================================== test session starts ====================================================================================
platform linux -- Python 3.9.18, pytest-8.1.1, pluggy-1.4.0
rootdir: /home/tkloczko/rpmbuild/BUILD/uvloop-0.19.0
configfile: pyproject.toml
testpaths: tests
plugins: hypothesis-6.99.5
collected 504 items

tests/test_aiohttp.py ....
tests/test_base.py .......................................................................................
tests/test_context.py ..................s....s......
tests/test_cython.py .
tests/test_dealloc.py F
tests/test_dns.py ..................FFs..............................
tests/test_executors.py ....
tests/test_fs_event.py ..
tests/test_libuv_api.py ..
tests/test_pipes.py ............
tests/test_process.py ..Traceback (most recent call last):
  File "<string>", line 29, in <module>
  File "/home/tkloczko/rpmbuild/BUILD/uvloop-0.19.0/uvloop/__init__.py", line 9, in <module>
    from uvloop.loop import Loop as __BaseLoop  # NOQA
ModuleNotFoundError: No module named 'uvloop.loop'
F...............................................................................
tests/test_process_spawning.py .
tests/test_regr1.py .
tests/test_runner.py ..
tests/test_signals.py F.Traceback (most recent call last):
  File "<string>", line 7, in <module>
  File "/home/tkloczko/rpmbuild/BUILD/uvloop-0.19.0/uvloop/__init__.py", line 9, in <module>
    from uvloop.loop import Loop as __BaseLoop  # NOQA
ModuleNotFoundError: No module named 'uvloop.loop'
F..FFFFFFF.Traceback (most recent call last):
  File "<string>", line 7, in <module>
  File "/home/tkloczko/rpmbuild/BUILD/uvloop-0.19.0/uvloop/__init__.py", line 9, in <module>
    from uvloop.loop import Loop as __BaseLoop  # NOQA
ModuleNotFoundError: No module named 'uvloop.loop'
F.FFFFFF
tests/test_sockets.py .................................
tests/test_sourcecode.py ss
tests/test_tcp.py ...............................................................s................s.s.ss.ssssssss.ss..ssssssss
tests/test_testbase.py ...
tests/test_udp.py .......................
tests/test_unix.py ..................................

========================================================================================= FAILURES ==========================================================================================
________________________________________________________________________________ TestDealloc.test_dealloc_1 _________________________________________________________________________________
Traceback (most recent call last):
  File "/usr/lib64/python3.9/unittest/case.py", line 59, in testPartExecutor
    yield
  File "/usr/lib64/python3.9/unittest/case.py", line 592, in run
    self._callTestMethod(testMethod)
  File "/usr/lib64/python3.9/unittest/case.py", line 550, in _callTestMethod
    method()
  File "/home/tkloczko/rpmbuild/BUILD/uvloop-0.19.0/tests/test_dealloc.py", line 61, in test_dealloc_1
    self.assertEqual(err, b'', 'stderr is not empty')
  File "/usr/lib64/python3.9/unittest/case.py", line 837, in assertEqual
    assertion_func(first, second, msg=msg)
  File "/usr/lib64/python3.9/unittest/case.py", line 830, in _baseAssertEqual
    raise self.failureException(msg)
AssertionError: b'Traceback (most recent call last):\n  Fil[235 chars]\'\n' != b'' : stderr is not empty
______________________________________________________________________________ Test_UV_DNS.test_getaddrinfo_8 _______________________________________________________________________________
Traceback (most recent call last):
  File "/home/tkloczko/rpmbuild/BUILD/uvloop-0.19.0/tests/test_dns.py", line 33, in _test_getaddrinfo
    a1 = socket.getaddrinfo(*args, **kwargs)
  File "/usr/lib64/python3.9/socket.py", line 954, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib64/python3.9/unittest/case.py", line 59, in testPartExecutor
    yield
  File "/usr/lib64/python3.9/unittest/case.py", line 592, in run
    self._callTestMethod(testMethod)
  File "/usr/lib64/python3.9/unittest/case.py", line 550, in _callTestMethod
    method()
  File "/home/tkloczko/rpmbuild/BUILD/uvloop-0.19.0/tests/test_dns.py", line 107, in test_getaddrinfo_8
    self._test_getaddrinfo('', 0)
  File "/home/tkloczko/rpmbuild/BUILD/uvloop-0.19.0/tests/test_dns.py", line 48, in _test_getaddrinfo
    raise ex
  File "/home/tkloczko/rpmbuild/BUILD/uvloop-0.19.0/tests/test_dns.py", line 38, in _test_getaddrinfo
    a2 = self.loop.run_until_complete(
  File "uvloop/loop.pyx", line 1516, in uvloop.loop.Loop.run_until_complete
    return future.result()
  File "uvloop/loop.pyx", line 1527, in getaddrinfo
    return await self._getaddrinfo(
OSError: [Errno 22] Invalid argument
______________________________________________________________________________ Test_UV_DNS.test_getaddrinfo_9 _______________________________________________________________________________
Traceback (most recent call last):
  File "/home/tkloczko/rpmbuild/BUILD/uvloop-0.19.0/tests/test_dns.py", line 33, in _test_getaddrinfo
    a1 = socket.getaddrinfo(*args, **kwargs)
  File "/usr/lib64/python3.9/socket.py", line 954, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib64/python3.9/unittest/case.py", line 59, in testPartExecutor
    yield
  File "/usr/lib64/python3.9/unittest/case.py", line 592, in run
    self._callTestMethod(testMethod)
  File "/usr/lib64/python3.9/unittest/case.py", line 550, in _callTestMethod
    method()
  File "/home/tkloczko/rpmbuild/BUILD/uvloop-0.19.0/tests/test_dns.py", line 111, in test_getaddrinfo_9
    self._test_getaddrinfo(b'', 0)
  File "/home/tkloczko/rpmbuild/BUILD/uvloop-0.19.0/tests/test_dns.py", line 48, in _test_getaddrinfo
    raise ex
  File "/home/tkloczko/rpmbuild/BUILD/uvloop-0.19.0/tests/test_dns.py", line 38, in _test_getaddrinfo
    a2 = self.loop.run_until_complete(
  File "uvloop/loop.pyx", line 1516, in uvloop.loop.Loop.run_until_complete
    return future.result()
  File "uvloop/loop.pyx", line 1527, in getaddrinfo
    return await self._getaddrinfo(
OSError: [Errno 22] Invalid argument
_________________________________________________________________________ Test_UV_Process.test_process_double_close _________________________________________________________________________
Traceback (most recent call last):
  File "/usr/lib64/python3.9/unittest/case.py", line 59, in testPartExecutor
    yield
  File "/usr/lib64/python3.9/unittest/case.py", line 592, in run
    self._callTestMethod(testMethod)
  File "/usr/lib64/python3.9/unittest/case.py", line 550, in _callTestMethod
    method()
  File "/home/tkloczko/rpmbuild/BUILD/uvloop-0.19.0/tests/test_process.py", line 863, in test_process_double_close
    subprocess.run([sys.executable, '-c', script], check=True)
  File "/usr/lib64/python3.9/subprocess.py", line 528, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/usr/bin/python3', '-c', '\nimport os\nimport sys\nfrom unittest import mock\n\nimport asyncio\n\npipes = []\noriginal_os_pipe = os.pipe\ndef log_pipes():\n    pipe = original_os_pipe()\n    pipes.append(pipe)\n    return pipe\n\ndups = []\noriginal_os_dup = os.dup\ndef log_dups(*args, **kwargs):\n    dup = original_os_dup(*args, **kwargs)\n    dups.append(dup)\n    return dup\n\nwith mock.patch(\n    "os.close", wraps=os.close\n) as os_close, mock.patch(\n    "os.pipe", new=log_pipes\n), mock.patch(\n    "os.dup", new=log_dups\n):\n    import uvloop\n\n\nasync def test():\n    proc = await asyncio.create_subprocess_exec(\n        sys.executable, "-c", "pass"\n    )\n    await proc.communicate()\n\nuvloop.run(test())\n\nstdin, stdout, stderr = dups\n(r, w), = pipes\nassert os_close.mock_calls == [\n    mock.call(w),\n    mock.call(r),\n    mock.call(stderr),\n    mock.call(stdout),\n    mock.call(stdin),\n]\n']' returned non-zero exit status 1.
_____________________________________________________________________ Test_UV_Signals.test_signals_and_custom_handler_1 _____________________________________________________________________
Traceback (most recent call last):
  File "/usr/lib64/python3.9/unittest/case.py", line 59, in testPartExecutor
    yield
  File "/usr/lib64/python3.9/unittest/case.py", line 592, in run
    self._callTestMethod(testMethod)
  File "/usr/lib64/python3.9/unittest/case.py", line 550, in _callTestMethod
    method()
  File "/usr/lib64/python3.9/contextlib.py", line 79, in inner
    return func(*args, **kwds)
  File "/home/tkloczko/rpmbuild/BUILD/uvloop-0.19.0/tests/test_signals.py", line 296, in test_signals_and_custom_handler_1
    self.loop.run_until_complete(runner())
  File "uvloop/loop.pyx", line 1516, in uvloop.loop.Loop.run_until_complete
    return future.result()
  File "/home/tkloczko/rpmbuild/BUILD/uvloop-0.19.0/tests/test_signals.py", line 280, in runner
    proc.send_signal(signal.SIGUSR1)
  File "/usr/lib64/python3.9/asyncio/subprocess.py", line 138, in send_signal
    self._transport.send_signal(signal)
  File "uvloop/handles/process.pyx", line 667, in uvloop.loop.UVProcessTransport.send_signal
    self._check_proc()
  File "uvloop/handles/process.pyx", line 401, in uvloop.loop.UVProcessTransport._check_proc
    raise ProcessLookupError()
ProcessLookupError
________________________________________________________________________ Test_UV_Signals.test_signals_fork_in_thread ________________________________________________________________________
Traceback (most recent call last):
  File "/usr/lib64/python3.9/unittest/case.py", line 59, in testPartExecutor
    yield
  File "/usr/lib64/python3.9/unittest/case.py", line 592, in run
    self._callTestMethod(testMethod)
  File "/usr/lib64/python3.9/unittest/case.py", line 550, in _callTestMethod
    method()
  File "/home/tkloczko/rpmbuild/BUILD/uvloop-0.19.0/tests/test_signals.py", line 382, in test_signals_fork_in_thread
    subprocess.check_call([
  File "/usr/lib64/python3.9/subprocess.py", line 373, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/usr/bin/python3', b'-W', b'ignore', b'-c', "\\\nimport asyncio\nimport multiprocessing\nimport signal\nimport sys\nimport threading\nimport uvloop\n\nmultiprocessing.set_start_method('fork')\n\ndef subprocess():\n    loop = uvloop.new_event_loop()\n    loop.add_signal_handler(signal.SIGINT, lambda *a: None)\n\ndef run():\n    loop = uvloop.new_event_loop()\n    loop.add_signal_handler(signal.SIGINT, lambda *a: None)\n    p = multiprocessing.Process(target=subprocess)\n    t = threading.Thread(target=p.start)\n    t.start()\n    t.join()\n    p.join()\n    sys.exit(p.exitcode)\n\nrun()\n"]' returned non-zero exit status 1.
__________________________________________________________________ Test_UV_Signals.test_signals_sigint_and_custom_handler ___________________________________________________________________
Traceback (most recent call last):
  File "/usr/lib64/python3.9/unittest/case.py", line 59, in testPartExecutor
    yield
  File "/usr/lib64/python3.9/unittest/case.py", line 592, in run
    self._callTestMethod(testMethod)
  File "/usr/lib64/python3.9/unittest/case.py", line 550, in _callTestMethod
    method()
  File "/usr/lib64/python3.9/contextlib.py", line 79, in inner
    return func(*args, **kwds)
  File "/home/tkloczko/rpmbuild/BUILD/uvloop-0.19.0/tests/test_signals.py", line 229, in test_signals_sigint_and_custom_handler
    self.loop.run_until_complete(runner())
  File "uvloop/loop.pyx", line 1516, in uvloop.loop.Loop.run_until_complete
    return future.result()
  File "/home/tkloczko/rpmbuild/BUILD/uvloop-0.19.0/tests/test_signals.py", line 221, in runner
    proc.send_signal(signal.SIGHUP)
  File "/usr/lib64/python3.9/asyncio/subprocess.py", line 138, in send_signal
    self._transport.send_signal(signal)
  File "uvloop/handles/process.pyx", line 667, in uvloop.loop.UVProcessTransport.send_signal
    self._check_proc()
  File "uvloop/handles/process.pyx", line 401, in uvloop.loop.UVProcessTransport._check_proc
    raise ProcessLookupError()
ProcessLookupError
____________________________________________________________________ Test_UV_Signals.test_signals_sigint_pycode_continue ____________________________________________________________________
Traceback (most recent call last):
  File "/usr/lib64/python3.9/unittest/case.py", line 59, in testPartExecutor
    yield
  File "/usr/lib64/python3.9/unittest/case.py", line 592, in run
    self._callTestMethod(testMethod)
  File "/usr/lib64/python3.9/unittest/case.py", line 550, in _callTestMethod
    method()
  File "/usr/lib64/python3.9/contextlib.py", line 79, in inner
    return func(*args, **kwds)
  File "/home/tkloczko/rpmbuild/BUILD/uvloop-0.19.0/tests/test_signals.py", line 98, in test_signals_sigint_pycode_continue
    self.loop.run_until_complete(runner())
  File "uvloop/loop.pyx", line 1516, in uvloop.loop.Loop.run_until_complete
    return future.result()
  File "/home/tkloczko/rpmbuild/BUILD/uvloop-0.19.0/tests/test_signals.py", line 93, in runner
    proc.send_signal(signal.SIGINT)
  File "/usr/lib64/python3.9/asyncio/subprocess.py", line 138, in send_signal
    self._transport.send_signal(signal)
  File "uvloop/handles/process.pyx", line 667, in uvloop.loop.UVProcessTransport.send_signal
    self._check_proc()
  File "uvloop/handles/process.pyx", line 401, in uvloop.loop.UVProcessTransport._check_proc
    raise ProcessLookupError()
ProcessLookupError
______________________________________________________________________ Test_UV_Signals.test_signals_sigint_pycode_stop ______________________________________________________________________
Traceback (most recent call last):
  File "/usr/lib64/python3.9/unittest/case.py", line 59, in testPartExecutor
    yield
  File "/usr/lib64/python3.9/unittest/case.py", line 592, in run
    self._callTestMethod(testMethod)
  File "/usr/lib64/python3.9/unittest/case.py", line 550, in _callTestMethod
    method()
  File "/usr/lib64/python3.9/contextlib.py", line 79, in inner
    return func(*args, **kwds)
  File "/home/tkloczko/rpmbuild/BUILD/uvloop-0.19.0/tests/test_signals.py", line 53, in test_signals_sigint_pycode_stop
    self.loop.run_until_complete(runner())
  File "uvloop/loop.pyx", line 1516, in uvloop.loop.Loop.run_until_complete
    return future.result()
  File "/home/tkloczko/rpmbuild/BUILD/uvloop-0.19.0/tests/test_signals.py", line 48, in runner
    proc.send_signal(signal.SIGINT)
  File "/usr/lib64/python3.9/asyncio/subprocess.py", line 138, in send_signal
    self._transport.send_signal(signal)
  File "uvloop/handles/process.pyx", line 667, in uvloop.loop.UVProcessTransport.send_signal
    self._check_proc()
  File "uvloop/handles/process.pyx", line 401, in uvloop.loop.UVProcessTransport._check_proc
    raise ProcessLookupError()
ProcessLookupError
________________________________________________________________________ Test_UV_Signals.test_signals_sigint_uvcode _________________________________________________________________________
Traceback (most recent call last):
  File "/usr/lib64/python3.9/unittest/case.py", line 59, in testPartExecutor
    yield
  File "/usr/lib64/python3.9/unittest/case.py", line 592, in run
    self._callTestMethod(testMethod)
  File "/usr/lib64/python3.9/unittest/case.py", line 550, in _callTestMethod
    method()
  File "/usr/lib64/python3.9/contextlib.py", line 79, in inner
    return func(*args, **kwds)
  File "/home/tkloczko/rpmbuild/BUILD/uvloop-0.19.0/tests/test_signals.py", line 137, in test_signals_sigint_uvcode
    self.loop.run_until_complete(runner())
  File "uvloop/loop.pyx", line 1516, in uvloop.loop.Loop.run_until_complete
    return future.result()
  File "/home/tkloczko/rpmbuild/BUILD/uvloop-0.19.0/tests/test_signals.py", line 133, in runner
    proc.send_signal(signal.SIGINT)
  File "/usr/lib64/python3.9/asyncio/subprocess.py", line 138, in send_signal
    self._transport.send_signal(signal)
  File "uvloop/handles/process.pyx", line 667, in uvloop.loop.UVProcessTransport.send_signal
    self._check_proc()
  File "uvloop/handles/process.pyx", line 401, in uvloop.loop.UVProcessTransport._check_proc
    raise ProcessLookupError()
ProcessLookupError
_________________________________________________________________ Test_UV_Signals.test_signals_sigint_uvcode_two_loop_runs __________________________________________________________________
Traceback (most recent call last):
  File "/usr/lib64/python3.9/unittest/case.py", line 59, in testPartExecutor
    yield
  File "/usr/lib64/python3.9/unittest/case.py", line 592, in run
    self._callTestMethod(testMethod)
  File "/usr/lib64/python3.9/unittest/case.py", line 550, in _callTestMethod
    method()
  File "/usr/lib64/python3.9/contextlib.py", line 79, in inner
    return func(*args, **kwds)
  File "/home/tkloczko/rpmbuild/BUILD/uvloop-0.19.0/tests/test_signals.py", line 176, in test_signals_sigint_uvcode_two_loop_runs
    self.loop.run_until_complete(runner())
  File "uvloop/loop.pyx", line 1516, in uvloop.loop.Loop.run_until_complete
    return future.result()
  File "/home/tkloczko/rpmbuild/BUILD/uvloop-0.19.0/tests/test_signals.py", line 172, in runner
    proc.send_signal(signal.SIGINT)
  File "/usr/lib64/python3.9/asyncio/subprocess.py", line 138, in send_signal
    self._transport.send_signal(signal)
  File "uvloop/handles/process.pyx", line 667, in uvloop.loop.UVProcessTransport.send_signal
    self._check_proc()
  File "uvloop/handles/process.pyx", line 401, in uvloop.loop.UVProcessTransport._check_proc
    raise ProcessLookupError()
ProcessLookupError
_____________________________________________________________________ Test_UV_Signals.test_signals_wakeup_fd_unchanged ______________________________________________________________________
Traceback (most recent call last):
  File "/usr/lib64/python3.9/unittest/case.py", line 59, in testPartExecutor
    yield
  File "/usr/lib64/python3.9/unittest/case.py", line 592, in run
    self._callTestMethod(testMethod)
  File "/usr/lib64/python3.9/unittest/case.py", line 550, in _callTestMethod
    method()
  File "/home/tkloczko/rpmbuild/BUILD/uvloop-0.19.0/tests/test_signals.py", line 348, in test_signals_wakeup_fd_unchanged
    self.loop.run_until_complete(runner())
  File "uvloop/loop.pyx", line 1516, in uvloop.loop.Loop.run_until_complete
    return future.result()
  File "/home/tkloczko/rpmbuild/BUILD/uvloop-0.19.0/tests/test_signals.py", line 345, in runner
    self.assertEqual(err, b'')
  File "/usr/lib64/python3.9/unittest/case.py", line 837, in assertEqual
    assertion_func(first, second, msg=msg)
  File "/usr/lib64/python3.9/unittest/case.py", line 830, in _baseAssertEqual
    raise self.failureException(msg)
AssertionError: b'Traceback (most recent call last):\n  Fil[235 chars]\'\n' != b''
____________________________________________________________________ Test_AIO_Signals.test_signals_and_custom_handler_1 _____________________________________________________________________
Traceback (most recent call last):
  File "/usr/lib64/python3.9/unittest/case.py", line 59, in testPartExecutor
    yield
  File "/usr/lib64/python3.9/unittest/case.py", line 592, in run
    self._callTestMethod(testMethod)
  File "/usr/lib64/python3.9/unittest/case.py", line 550, in _callTestMethod
    method()
  File "/usr/lib64/python3.9/contextlib.py", line 79, in inner
    return func(*args, **kwds)
  File "/home/tkloczko/rpmbuild/BUILD/uvloop-0.19.0/tests/test_signals.py", line 296, in test_signals_and_custom_handler_1
    self.loop.run_until_complete(runner())
  File "/usr/lib64/python3.9/asyncio/base_events.py", line 647, in run_until_complete
    return future.result()
  File "/home/tkloczko/rpmbuild/BUILD/uvloop-0.19.0/tests/test_signals.py", line 293, in runner
    self.assertEqual(err, b'')
  File "/usr/lib64/python3.9/unittest/case.py", line 837, in assertEqual
    assertion_func(first, second, msg=msg)
  File "/usr/lib64/python3.9/unittest/case.py", line 830, in _baseAssertEqual
    raise self.failureException(msg)
AssertionError: b'Traceback (most recent call last):\n  Fil[235 chars]\'\n' != b''
_______________________________________________________________________ Test_AIO_Signals.test_signals_fork_in_thread ________________________________________________________________________
Traceback (most recent call last):
  File "/usr/lib64/python3.9/unittest/case.py", line 59, in testPartExecutor
    yield
  File "/usr/lib64/python3.9/unittest/case.py", line 592, in run
    self._callTestMethod(testMethod)
  File "/usr/lib64/python3.9/unittest/case.py", line 550, in _callTestMethod
    method()
  File "/home/tkloczko/rpmbuild/BUILD/uvloop-0.19.0/tests/test_signals.py", line 382, in test_signals_fork_in_thread
    subprocess.check_call([
  File "/usr/lib64/python3.9/subprocess.py", line 373, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/usr/bin/python3', b'-W', b'ignore', b'-c', "\\\nimport asyncio\nimport multiprocessing\nimport signal\nimport sys\nimport threading\nimport uvloop\n\nmultiprocessing.set_start_method('fork')\n\ndef subprocess():\n    loop = asyncio.new_event_loop()\n    loop.add_signal_handler(signal.SIGINT, lambda *a: None)\n\ndef run():\n    loop = asyncio.new_event_loop()\n    loop.add_signal_handler(signal.SIGINT, lambda *a: None)\n    p = multiprocessing.Process(target=subprocess)\n    t = threading.Thread(target=p.start)\n    t.start()\n    t.join()\n    p.join()\n    sys.exit(p.exitcode)\n\nrun()\n"]' returned non-zero exit status 1.
__________________________________________________________________ Test_AIO_Signals.test_signals_sigint_and_custom_handler __________________________________________________________________
Traceback (most recent call last):
  File "/usr/lib64/python3.9/unittest/case.py", line 59, in testPartExecutor
    yield
  File "/usr/lib64/python3.9/unittest/case.py", line 592, in run
    self._callTestMethod(testMethod)
  File "/usr/lib64/python3.9/unittest/case.py", line 550, in _callTestMethod
    method()
  File "/usr/lib64/python3.9/contextlib.py", line 79, in inner
    return func(*args, **kwds)
  File "/home/tkloczko/rpmbuild/BUILD/uvloop-0.19.0/tests/test_signals.py", line 229, in test_signals_sigint_and_custom_handler
    self.loop.run_until_complete(runner())
  File "/usr/lib64/python3.9/asyncio/base_events.py", line 647, in run_until_complete
    return future.result()
  File "/home/tkloczko/rpmbuild/BUILD/uvloop-0.19.0/tests/test_signals.py", line 225, in runner
    self.assertEqual(err, b'')
  File "/usr/lib64/python3.9/unittest/case.py", line 837, in assertEqual
    assertion_func(first, second, msg=msg)
  File "/usr/lib64/python3.9/unittest/case.py", line 830, in _baseAssertEqual
    raise self.failureException(msg)
AssertionError: b'Traceback (most recent call last):\n  Fil[235 chars]\'\n' != b''
___________________________________________________________________ Test_AIO_Signals.test_signals_sigint_pycode_continue ____________________________________________________________________
Traceback (most recent call last):
  File "/usr/lib64/python3.9/unittest/case.py", line 59, in testPartExecutor
    yield
  File "/usr/lib64/python3.9/unittest/case.py", line 592, in run
    self._callTestMethod(testMethod)
  File "/usr/lib64/python3.9/unittest/case.py", line 550, in _callTestMethod
    method()
  File "/usr/lib64/python3.9/contextlib.py", line 79, in inner
    return func(*args, **kwds)
  File "/home/tkloczko/rpmbuild/BUILD/uvloop-0.19.0/tests/test_signals.py", line 98, in test_signals_sigint_pycode_continue
    self.loop.run_until_complete(runner())
  File "/usr/lib64/python3.9/asyncio/base_events.py", line 647, in run_until_complete
    return future.result()
  File "/home/tkloczko/rpmbuild/BUILD/uvloop-0.19.0/tests/test_signals.py", line 95, in runner
    self.assertEqual(err, b'')
  File "/usr/lib64/python3.9/unittest/case.py", line 837, in assertEqual
    assertion_func(first, second, msg=msg)
  File "/usr/lib64/python3.9/unittest/case.py", line 830, in _baseAssertEqual
    raise self.failureException(msg)
AssertionError: b'Traceback (most recent call last):\n  Fil[235 chars]\'\n' != b''
_____________________________________________________________________ Test_AIO_Signals.test_signals_sigint_pycode_stop ______________________________________________________________________
Traceback (most recent call last):
  File "/usr/lib64/python3.9/unittest/case.py", line 59, in testPartExecutor
    yield
  File "/usr/lib64/python3.9/unittest/case.py", line 592, in run
    self._callTestMethod(testMethod)
  File "/usr/lib64/python3.9/unittest/case.py", line 550, in _callTestMethod
    method()
  File "/usr/lib64/python3.9/contextlib.py", line 79, in inner
    return func(*args, **kwds)
  File "/home/tkloczko/rpmbuild/BUILD/uvloop-0.19.0/tests/test_signals.py", line 53, in test_signals_sigint_pycode_stop
    self.loop.run_until_complete(runner())
  File "/usr/lib64/python3.9/asyncio/base_events.py", line 647, in run_until_complete
    return future.result()
  File "/home/tkloczko/rpmbuild/BUILD/uvloop-0.19.0/tests/test_signals.py", line 50, in runner
    self.assertIn(b'KeyboardInterrupt', err)
  File "/usr/lib64/python3.9/unittest/case.py", line 1104, in assertIn
    self.fail(self._formatMessage(msg, standardMsg))
  File "/usr/lib64/python3.9/unittest/case.py", line 676, in fail
    raise self.failureException(msg)
AssertionError: b'KeyboardInterrupt' not found in b'Traceback (most recent call last):\n  File "<string>", line 3, in <module>\n  File "/home/tkloczko/rpmbuild/BUILD/uvloop-0.19.0/uvloop/__init__.py", line 9, in <module>\n    from uvloop.loop import Loop as __BaseLoop  # NOQA\nModuleNotFoundError: No module named \'uvloop.loop\'\n'
________________________________________________________________________ Test_AIO_Signals.test_signals_sigint_uvcode ________________________________________________________________________
Traceback (most recent call last):
  File "/usr/lib64/python3.9/unittest/case.py", line 59, in testPartExecutor
    yield
  File "/usr/lib64/python3.9/unittest/case.py", line 592, in run
    self._callTestMethod(testMethod)
  File "/usr/lib64/python3.9/unittest/case.py", line 550, in _callTestMethod
    method()
  File "/usr/lib64/python3.9/contextlib.py", line 79, in inner
    return func(*args, **kwds)
  File "/home/tkloczko/rpmbuild/BUILD/uvloop-0.19.0/tests/test_signals.py", line 137, in test_signals_sigint_uvcode
    self.loop.run_until_complete(runner())
  File "/usr/lib64/python3.9/asyncio/base_events.py", line 647, in run_until_complete
    return future.result()
  File "/home/tkloczko/rpmbuild/BUILD/uvloop-0.19.0/tests/test_signals.py", line 135, in runner
    self.assertIn(b'KeyboardInterrupt', err)
  File "/usr/lib64/python3.9/unittest/case.py", line 1104, in assertIn
    self.fail(self._formatMessage(msg, standardMsg))
  File "/usr/lib64/python3.9/unittest/case.py", line 676, in fail
    raise self.failureException(msg)
AssertionError: b'KeyboardInterrupt' not found in b'Traceback (most recent call last):\n  File "<string>", line 3, in <module>\n  File "/home/tkloczko/rpmbuild/BUILD/uvloop-0.19.0/uvloop/__init__.py", line 9, in <module>\n    from uvloop.loop import Loop as __BaseLoop  # NOQA\nModuleNotFoundError: No module named \'uvloop.loop\'\n'
_________________________________________________________________ Test_AIO_Signals.test_signals_sigint_uvcode_two_loop_runs _________________________________________________________________
Traceback (most recent call last):
  File "/usr/lib64/python3.9/unittest/case.py", line 59, in testPartExecutor
    yield
  File "/usr/lib64/python3.9/unittest/case.py", line 592, in run
    self._callTestMethod(testMethod)
  File "/usr/lib64/python3.9/unittest/case.py", line 550, in _callTestMethod
    method()
  File "/usr/lib64/python3.9/contextlib.py", line 79, in inner
    return func(*args, **kwds)
  File "/home/tkloczko/rpmbuild/BUILD/uvloop-0.19.0/tests/test_signals.py", line 176, in test_signals_sigint_uvcode_two_loop_runs
    self.loop.run_until_complete(runner())
  File "/usr/lib64/python3.9/asyncio/base_events.py", line 647, in run_until_complete
    return future.result()
  File "/home/tkloczko/rpmbuild/BUILD/uvloop-0.19.0/tests/test_signals.py", line 174, in runner
    self.assertIn(b'KeyboardInterrupt', err)
  File "/usr/lib64/python3.9/unittest/case.py", line 1104, in assertIn
    self.fail(self._formatMessage(msg, standardMsg))
  File "/usr/lib64/python3.9/unittest/case.py", line 676, in fail
    raise self.failureException(msg)
AssertionError: b'KeyboardInterrupt' not found in b'Traceback (most recent call last):\n  File "<string>", line 3, in <module>\n  File "/home/tkloczko/rpmbuild/BUILD/uvloop-0.19.0/uvloop/__init__.py", line 9, in <module>\n    from uvloop.loop import Loop as __BaseLoop  # NOQA\nModuleNotFoundError: No module named \'uvloop.loop\'\n'
_____________________________________________________________________ Test_AIO_Signals.test_signals_wakeup_fd_unchanged _____________________________________________________________________
Traceback (most recent call last):
  File "/usr/lib64/python3.9/unittest/case.py", line 59, in testPartExecutor
    yield
  File "/usr/lib64/python3.9/unittest/case.py", line 592, in run
    self._callTestMethod(testMethod)
  File "/usr/lib64/python3.9/unittest/case.py", line 550, in _callTestMethod
    method()
  File "/home/tkloczko/rpmbuild/BUILD/uvloop-0.19.0/tests/test_signals.py", line 348, in test_signals_wakeup_fd_unchanged
    self.loop.run_until_complete(runner())
  File "/usr/lib64/python3.9/asyncio/base_events.py", line 647, in run_until_complete
    return future.result()
  File "/home/tkloczko/rpmbuild/BUILD/uvloop-0.19.0/tests/test_signals.py", line 345, in runner
    self.assertEqual(err, b'')
  File "/usr/lib64/python3.9/unittest/case.py", line 837, in assertEqual
    assertion_func(first, second, msg=msg)
  File "/usr/lib64/python3.9/unittest/case.py", line 830, in _baseAssertEqual
    raise self.failureException(msg)
AssertionError: b'Traceback (most recent call last):\n  Fil[235 chars]\'\n' != b''
===================================================================================== warnings summary ======================================================================================
tests/test_aiohttp.py::Test_UV_AioHTTP::test_aiohttp_graceful_shutdown
tests/test_aiohttp.py::Test_AIO_AioHTTP::test_aiohttp_graceful_shutdown
  /home/tkloczko/rpmbuild/BUILD/uvloop-0.19.0/tests/test_aiohttp.py:81: NotAppKeyWarning: It is recommended to use web.AppKey instances for keys.
  https://docs.aiohttp.org/en/stable/web_advanced.html#application-s-config
    app['websockets'] = weakref.WeakSet()

tests/test_aiohttp.py::Test_UV_AioHTTP::test_aiohttp_graceful_shutdown
tests/test_aiohttp.py::Test_AIO_AioHTTP::test_aiohttp_graceful_shutdown
  /usr/lib64/python3.9/site-packages/aiohttp/web_runner.py:95: DeprecationWarning: shutdown_timeout should be set on BaseRunner
    super().__init__(

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
================================================================================== short test summary info ==================================================================================
SKIPPED [1] tests/test_context.py:435: this seems to be a bug in asyncio
SKIPPED [1] tests/test_context.py:578: this seems to be a bug in asyncio
SKIPPED [1] tests/test_dns.py:210: Skipped
SKIPPED [1] tests/test_sourcecode.py:13: flake8 module is missing
SKIPPED [1] tests/test_sourcecode.py:40: mypy module is missing
SKIPPED [2] tests/test_tcp.py:2654: Skipped
SKIPPED [1] tests/test_tcp.py:3023: bpo-39951
SKIPPED [1] tests/test_tcp.py:1769: Skipped
SKIPPED [1] tests/test_tcp.py:1483: Skipped
SKIPPED [1] tests/test_tcp.py:1447: Skipped
SKIPPED [1] tests/test_tcp.py:2079: asyncio does not support SSL over SSL
SKIPPED [1] tests/test_tcp.py:3105: Skipped
SKIPPED [1] tests/test_tcp.py:2586: Skipped
SKIPPED [1] tests/test_tcp.py:2816: Skipped
SKIPPED [1] tests/test_tcp.py:2225: asyncio does not support renegotiation
SKIPPED [1] tests/test_tcp.py:2443: Skipped
SKIPPED [1] tests/test_tcp.py:2345: Skipped
SKIPPED [1] tests/test_tcp.py:2883: Skipped
SKIPPED [1] tests/test_tcp.py:2941: Skipped
SKIPPED [1] tests/test_tcp.py:1535: Skipped
SKIPPED [1] tests/test_tcp.py:1835: Skipped
SKIPPED [1] tests/test_tcp.py:1656: Skipped
SKIPPED [1] tests/test_tcp.py:1705: Skipped
SKIPPED [1] tests/test_tcp.py:1997: Skipped
SKIPPED [1] tests/test_tcp.py:1934: Skipped
SKIPPED [1] tests/test_tcp.py:1520: Skipped
SKIPPED [1] tests/test_tcp.py:2507: Skipped
FAILED tests/test_dealloc.py::TestDealloc::test_dealloc_1 - AssertionError: b'Traceback (most recent call last):\n  Fil[235 chars]\'\n' != b'' : stderr is not empty
FAILED tests/test_dns.py::Test_UV_DNS::test_getaddrinfo_8 - OSError: [Errno 22] Invalid argument
FAILED tests/test_dns.py::Test_UV_DNS::test_getaddrinfo_9 - OSError: [Errno 22] Invalid argument
FAILED tests/test_process.py::Test_UV_Process::test_process_double_close - subprocess.CalledProcessError: Command '['/usr/bin/python3', '-c', '\nimport os\nimport sys\nfrom unittest import mock\n\nimport asyncio\n\npipes = []\noriginal_os_pipe = os.pipe\ndef ...
FAILED tests/test_signals.py::Test_UV_Signals::test_signals_and_custom_handler_1 - ProcessLookupError
FAILED tests/test_signals.py::Test_UV_Signals::test_signals_fork_in_thread - subprocess.CalledProcessError: Command '['/usr/bin/python3', b'-W', b'ignore', b'-c', "\\\nimport asyncio\nimport multiprocessing\nimport signal\nimport sys\nimport threading\nimport u...
FAILED tests/test_signals.py::Test_UV_Signals::test_signals_sigint_and_custom_handler - ProcessLookupError
FAILED tests/test_signals.py::Test_UV_Signals::test_signals_sigint_pycode_continue - ProcessLookupError
FAILED tests/test_signals.py::Test_UV_Signals::test_signals_sigint_pycode_stop - ProcessLookupError
FAILED tests/test_signals.py::Test_UV_Signals::test_signals_sigint_uvcode - ProcessLookupError
FAILED tests/test_signals.py::Test_UV_Signals::test_signals_sigint_uvcode_two_loop_runs - ProcessLookupError
FAILED tests/test_signals.py::Test_UV_Signals::test_signals_wakeup_fd_unchanged - AssertionError: b'Traceback (most recent call last):\n  Fil[235 chars]\'\n' != b''
FAILED tests/test_signals.py::Test_AIO_Signals::test_signals_and_custom_handler_1 - AssertionError: b'Traceback (most recent call last):\n  Fil[235 chars]\'\n' != b''
FAILED tests/test_signals.py::Test_AIO_Signals::test_signals_fork_in_thread - subprocess.CalledProcessError: Command '['/usr/bin/python3', b'-W', b'ignore', b'-c', "\\\nimport asyncio\nimport multiprocessing\nimport signal\nimport sys\nimport threading\nimport u...
FAILED tests/test_signals.py::Test_AIO_Signals::test_signals_sigint_and_custom_handler - AssertionError: b'Traceback (most recent call last):\n  Fil[235 chars]\'\n' != b''
FAILED tests/test_signals.py::Test_AIO_Signals::test_signals_sigint_pycode_continue - AssertionError: b'Traceback (most recent call last):\n  Fil[235 chars]\'\n' != b''
FAILED tests/test_signals.py::Test_AIO_Signals::test_signals_sigint_pycode_stop - AssertionError: b'KeyboardInterrupt' not found in b'Traceback (most recent call last):\n  File "<string>", line 3, in <module>\n  File "/home/tkloczko/rpmbuild/BUILD/uvloop-0.19.0/uvlo...
FAILED tests/test_signals.py::Test_AIO_Signals::test_signals_sigint_uvcode - AssertionError: b'KeyboardInterrupt' not found in b'Traceback (most recent call last):\n  File "<string>", line 3, in <module>\n  File "/home/tkloczko/rpmbuild/BUILD/uvloop-0.19.0/uvlo...
FAILED tests/test_signals.py::Test_AIO_Signals::test_signals_sigint_uvcode_two_loop_runs - AssertionError: b'KeyboardInterrupt' not found in b'Traceback (most recent call last):\n  File "<string>", line 3, in <module>\n  File "/home/tkloczko/rpmbuild/BUILD/uvloop-0.19.0/uvlo...
FAILED tests/test_signals.py::Test_AIO_Signals::test_signals_wakeup_fd_unchanged - AssertionError: b'Traceback (most recent call last):\n  Fil[235 chars]\'\n' != b''
============================================================ 20 failed, 456 passed, 28 skipped, 4 warnings in 102.03s (0:01:42) =============================================================

@kloczek
Copy link

kloczek commented Mar 17, 2024

Those fails are looking similar to what I've reported against older version #429 so looks like PR is OK 😋

@alan-brooks
Copy link
Contributor Author

thanks missed those dependencis

@edgarrmondragon
Copy link
Contributor

@fantix are there any blockers for merging this?

@fantix
Copy link
Member

fantix commented Aug 15, 2024

This looks promising! Sorry for the delay. I'm aiming to merge this weekend or next.

Copy link
Member

@fantix fantix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't check all the new noexcept functions - looks like some of them may still raise Python exceptions. Are those required for Cython 3 or it's just an optimization?

uvloop/cbhandles.pyx Outdated Show resolved Hide resolved
uvloop/includes/system.h Outdated Show resolved Hide resolved
uvloop/loop.pxd Outdated Show resolved Hide resolved
uvloop/loop.pxd Outdated Show resolved Hide resolved
uvloop/loop.pxd Outdated Show resolved Hide resolved
tests/test_process.py Outdated Show resolved Hide resolved
@fantix
Copy link
Member

fantix commented Aug 28, 2024

I didn't check all the new noexcept functions - looks like some of them may still raise Python exceptions. Are those required for Cython 3 or it's just an optimization?

I'm taking them out one by one as of now - feel free to drop an answer here and we can start a new PR to carefully add them back.

Copy link
Member

@fantix fantix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is good to go now. @1st1 wanna take a look too?

@fantix fantix merged commit 3fba9fa into MagicStack:master Aug 28, 2024
11 checks passed
fantix added a commit that referenced this pull request Oct 14, 2024
Changes
=======

* Add cleanup_socket param on create_unix_server() (#623)
  (by @fantix in d6114d2)

Fixes
=====

* Use cythonized SO_REUSEPORT rather than the unwrapped native one. (#609)
  (by @ptribble in 4083a94 for #550)

* UDP errors should result in protocol.error_received (#601)
  (by @jensbjorgensen in 3c3bbef)

* Updates for Cython3 (#587)
  (by @alan-brooks in 3fba9fa for #587)

* Test with Python 3.13 (#610)
  (by @edgarrmondragon in fb5a139)
@fantix fantix mentioned this pull request Oct 14, 2024
Copy link
Contributor

@jakirkham jakirkham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this! 🙏

Had a question about one of the changes below

Comment on lines -1 to +5
DEF __PREALLOCED_BUFS = 4
cdef extern from *:
'''
enum {__PREALLOCED_BUFS = 4};
'''
const bint __PREALLOCED_BUFS
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Am curious whether it would make sense to make this a Cython enum (or if there was some issue seen doing that)

Suggested change
DEF __PREALLOCED_BUFS = 4
cdef extern from *:
'''
enum {__PREALLOCED_BUFS = 4};
'''
const bint __PREALLOCED_BUFS
cdef enum:
__PREALLOCED_BUFS = 4

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think this is a good suggestion - it pretty much generates the same C code.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Fantix! 🙏

Submitted a PR: #634

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants