From: Stuart Henderson Subject: py-uvloop update To: Aisha Tammy Cc: ports Date: Mon, 20 Oct 2025 22:29:58 +0100 I started looking into this because of build failure on sparc64 on a 'nojunk' port, didn't manage to fix that, but have marked it to only compile with clang to at least help out for bulks. The update gets rid of a bunch of patches. There are no comments in the headers to check, but most seem to be upstream's diff adding cython 3 support - https://github.com/MagicStack/uvloop/commit/3fba9fab1e8d66c333cf3946d79e29b5bad8fa73 I removed the pytest bits disabling failing tests, the goal is not to get a clear run with no failures, but to make it obvious where things are not matching upstream's expectations - most pytest ports with a lot of --ignore or similar are doing this to avoid collection errors that prevent other tests running. And added comments explaining why others were disabled. Tests look good with py-uvicorn and py-redis which are the only things in ports using this. ok? Index: Makefile =================================================================== RCS file: /cvs/ports/devel/py-uvloop/Makefile,v diff -u -p -r1.5 Makefile --- Makefile 17 Jun 2025 10:34:45 -0000 1.5 +++ Makefile 20 Oct 2025 21:24:46 -0000 @@ -1,7 +1,6 @@ COMMENT = fast, drop-in replacement for asyncio event loop -MODPY_DISTV = 0.20.0 -REVISION = 3 +MODPY_DISTV = 0.22.1 DISTNAME = uvloop-${MODPY_DISTV} PKGNAME = py-uvloop-${MODPY_DISTV} @@ -15,6 +14,11 @@ MAINTAINER = Aisha Tammy Index: distinfo =================================================================== RCS file: /cvs/ports/devel/py-uvloop/distinfo,v diff -u -p -r1.1.1.1 distinfo --- distinfo 25 Aug 2024 00:31:48 -0000 1.1.1.1 +++ distinfo 20 Oct 2025 21:24:46 -0000 @@ -1,2 +1,2 @@ -SHA256 (uvloop-0.20.0.tar.gz) = RgPKcUp1T8jZsZfjJdslsuoEU4Xoo60F00Y95yX99Gk= -SIZE (uvloop-0.20.0.tar.gz) = 2329938 +SHA256 (uvloop-0.22.1.tar.gz) = bIS640W5FHCCsXNx491dQndb3c6R+IVJkBf0YH/a858= +SIZE (uvloop-0.22.1.tar.gz) = 2443250 Index: patches/patch-Makefile =================================================================== RCS file: patches/patch-Makefile diff -N patches/patch-Makefile --- patches/patch-Makefile 25 Aug 2024 00:31:48 -0000 1.1.1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,12 +0,0 @@ -Index: Makefile ---- Makefile.orig -+++ Makefile -@@ -9,7 +9,7 @@ _default: compile - - - clean: -- rm -fr dist/ doc/_build/ *.egg-info uvloop/loop.*.pyd -+ rm -fr dist/ doc/_build/ *.egg-info uvloop/loop.*.pyd uvloop/loop_d.*.pyd - rm -fr uvloop/*.c uvloop/*.html uvloop/*.so - rm -fr uvloop/handles/*.html uvloop/includes/*.html - find . -name '__pycache__' | xargs rm -rf Index: patches/patch-pyproject_toml =================================================================== RCS file: patches/patch-pyproject_toml diff -N patches/patch-pyproject_toml --- patches/patch-pyproject_toml 25 Aug 2024 00:31:48 -0000 1.1.1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,21 +0,0 @@ -Index: pyproject.toml ---- pyproject.toml.orig -+++ pyproject.toml -@@ -43,7 +43,7 @@ test = [ - '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 @@ docs = [ - requires = [ - "setuptools>=60", - "wheel", -- "Cython(>=0.29.36,<0.30.0)", -+ "Cython>=0.29.36", - ] - build-backend = "setuptools.build_meta" - Index: patches/patch-setup_cfg =================================================================== RCS file: patches/patch-setup_cfg diff -N patches/patch-setup_cfg --- patches/patch-setup_cfg 25 Aug 2024 00:31:48 -0000 1.1.1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,10 +0,0 @@ -Index: setup.cfg ---- setup.cfg.orig -+++ setup.cfg -@@ -2,3 +2,6 @@ - tag_build = - tag_date = 0 - -+[build_ext] -+use_system_libuv=True -+cython_always=True Index: patches/patch-setup_py =================================================================== RCS file: /cvs/ports/devel/py-uvloop/patches/patch-setup_py,v diff -u -p -r1.1.1.1 patch-setup_py --- patches/patch-setup_py 25 Aug 2024 00:31:48 -0000 1.1.1.1 +++ patches/patch-setup_py 20 Oct 2025 21:24:46 -0000 @@ -1,23 +1,23 @@ Index: setup.py --- setup.py.orig +++ setup.py -@@ -21,7 +21,7 @@ from setuptools.command.build_ext import build_ext - from setuptools.command.sdist import sdist +@@ -33,8 +33,6 @@ def _libuv_build_env(): + env = os.environ.copy() + cur_cflags = env.get('CFLAGS', '') +- if not re.search(r'-O\d', cur_cflags): +- cur_cflags += ' -O2' --CYTHON_DEPENDENCY = 'Cython(>=0.29.36,<0.30.0)' -+CYTHON_DEPENDENCY = 'Cython(>=0.29.36)' - MACHINE = platform.machine() - MODULES_CFLAGS = [os.getenv('UVLOOP_OPT_CFLAGS', '-O2')] - _ROOT = pathlib.Path(__file__).parent -@@ -144,7 +144,9 @@ class uvloop_build_ext(build_ext): - self.distribution.ext_modules[:] = cythonize( - self.distribution.ext_modules, - compiler_directives=directives, -- annotate=self.cython_annotate) -+ annotate=self.cython_annotate, -+ compile_time_env=dict(DEFAULT_FREELIST_SIZE=250, SSL_READ_MAX_SIZE=256 * 1024), -+ emit_linenums=True) + env['CFLAGS'] = (cur_cflags + ' -fPIC ' + env.get('ARCHFLAGS', '')) - super().finalize_options() +@@ -83,8 +81,8 @@ class uvloop_build_ext(build_ext): + + def initialize_options(self): + super().initialize_options() +- self.use_system_libuv = False +- self.cython_always = False ++ self.use_system_libuv = True ++ self.cython_always = True + self.cython_annotate = None + self.cython_directives = None Index: patches/patch-tests_test_process_py =================================================================== RCS file: patches/patch-tests_test_process_py diff -N patches/patch-tests_test_process_py --- patches/patch-tests_test_process_py 25 Aug 2024 00:31:48 -0000 1.1.1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,21 +0,0 @@ -Index: tests/test_process.py ---- tests/test_process.py.orig -+++ tests/test_process.py -@@ -912,7 +912,7 @@ class Test_UV_Process_Delayed(tb.UVTestCase): - stdin=subprocess.PIPE, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, -- __uvloop_sleep_after_fork=True)) -+ uvloop_sleep_after_fork=True)) - self.assertIsNot(transport, None) - self.assertEqual(transport.get_returncode(), 0) - self.assertEqual( -@@ -931,7 +931,7 @@ class Test_UV_Process_Delayed(tb.UVTestCase): - stdin=None, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, -- __uvloop_sleep_after_fork=True)) -+ uvloop_sleep_after_fork=True)) - self.assertIsNot(transport, None) - self.assertEqual(transport.get_returncode(), 0) - self.assertEqual( Index: patches/patch-tests_test_tcp_py =================================================================== RCS file: patches/patch-tests_test_tcp_py diff -N patches/patch-tests_test_tcp_py --- patches/patch-tests_test_tcp_py 25 Aug 2024 00:31:48 -0000 1.1.1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,49 +0,0 @@ -Index: tests/test_tcp.py ---- tests/test_tcp.py.orig -+++ tests/test_tcp.py -@@ -1631,17 +1631,22 @@ class _TestSSL(tb.SSLTestCase): - self.fail("unexpected call to connection_made()") - - def test_ssl_connect_accepted_socket(self): -- if hasattr(ssl, 'PROTOCOL_TLS'): -- proto = ssl.PROTOCOL_TLS -+ if hasattr(ssl, 'PROTOCOL_TLS_SERVER'): -+ server_proto = ssl.PROTOCOL_TLS_SERVER -+ client_proto = ssl.PROTOCOL_TLS_CLIENT - else: -- proto = ssl.PROTOCOL_SSLv23 -- server_context = ssl.SSLContext(proto) -+ if hasattr(ssl, 'PROTOCOL_TLS'): -+ client_proto = server_proto = ssl.PROTOCOL_TLS -+ else: -+ client_proto = server_proto = ssl.PROTOCOL_SSLv23 -+ -+ server_context = ssl.SSLContext(server_proto) - server_context.load_cert_chain(self.ONLYCERT, self.ONLYKEY) - if hasattr(server_context, 'check_hostname'): - server_context.check_hostname = False - server_context.verify_mode = ssl.CERT_NONE - -- client_context = ssl.SSLContext(proto) -+ client_context = ssl.SSLContext(client_proto) - if hasattr(server_context, 'check_hostname'): - client_context.check_hostname = False - client_context.verify_mode = ssl.CERT_NONE -@@ -2234,7 +2239,7 @@ class _TestSSL(tb.SSLTestCase): - sslctx.use_privatekey_file(self.ONLYKEY) - sslctx.use_certificate_chain_file(self.ONLYCERT) - client_sslctx = self._create_client_ssl_context() -- if hasattr(ssl, 'OP_NO_TLSv1_3'): -+ if sys.version_info < (3, 8) and hasattr(ssl, 'OP_NO_TLSv1_3'): - client_sslctx.options |= ssl.OP_NO_TLSv1_3 - - def server(sock): -@@ -2593,7 +2598,7 @@ class _TestSSL(tb.SSLTestCase): - sslctx_openssl.use_privatekey_file(self.ONLYKEY) - sslctx_openssl.use_certificate_chain_file(self.ONLYCERT) - client_sslctx = self._create_client_ssl_context() -- if hasattr(ssl, 'OP_NO_TLSv1_3'): -+ if sys.version_info < (3, 8) and hasattr(ssl, 'OP_NO_TLSv1_3'): - client_sslctx.options |= ssl.OP_NO_TLSv1_3 - - future = None Index: patches/patch-uvloop__testbase_py =================================================================== RCS file: patches/patch-uvloop__testbase_py diff -N patches/patch-uvloop__testbase_py --- patches/patch-uvloop__testbase_py 25 Aug 2024 00:31:48 -0000 1.1.1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,14 +0,0 @@ -Index: uvloop/_testbase.py ---- uvloop/_testbase.py.orig -+++ uvloop/_testbase.py -@@ -269,7 +269,9 @@ def find_free_port(start_from=50000): - class SSLTestCase: - - def _create_server_ssl_context(self, certfile, keyfile=None): -- if hasattr(ssl, 'PROTOCOL_TLS'): -+ if hasattr(ssl, 'PROTOCOL_TLS_SERVER'): -+ sslcontext = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) -+ elif hasattr(ssl, 'PROTOCOL_TLS'): - sslcontext = ssl.SSLContext(ssl.PROTOCOL_TLS) - else: - sslcontext = ssl.SSLContext(ssl.PROTOCOL_SSLv23) Index: patches/patch-uvloop_cbhandles_pyx =================================================================== RCS file: patches/patch-uvloop_cbhandles_pyx diff -N patches/patch-uvloop_cbhandles_pyx --- patches/patch-uvloop_cbhandles_pyx 25 Aug 2024 00:31:48 -0000 1.1.1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,14 +0,0 @@ -Index: uvloop/cbhandles.pyx ---- uvloop/cbhandles.pyx.orig -+++ uvloop/cbhandles.pyx -@@ -76,8 +76,8 @@ cdef class Handle: - self.arg1, self.arg2, self.arg3, self.arg4) - - else: -- raise RuntimeError('invalid Handle.cb_type: {}'.format( -- cb_type)) -+ raise RuntimeError('invalid Handle.cb_type: {} {!r}/{!r}'.format( -+ cb_type, self.args1, self.args2)) - - except (KeyboardInterrupt, SystemExit): - raise Index: patches/patch-uvloop_dns_pyx =================================================================== RCS file: patches/patch-uvloop_dns_pyx diff -N patches/patch-uvloop_dns_pyx --- patches/patch-uvloop_dns_pyx 25 Aug 2024 00:31:48 -0000 1.1.1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,21 +0,0 @@ -Index: uvloop/dns.pyx ---- uvloop/dns.pyx.orig -+++ uvloop/dns.pyx -@@ -298,7 +298,7 @@ cdef class AddrInfo: - uv.uv_freeaddrinfo(self.data) # returns void - self.data = NULL - -- cdef void set_data(self, system.addrinfo *data): -+ cdef void set_data(self, system.addrinfo *data) noexcept: - self.data = data - - cdef unpack(self): -@@ -326,7 +326,7 @@ cdef class AddrInfo: - return result - - @staticmethod -- cdef int isinstance(object other): -+ cdef int isinstance(object other) noexcept: - return type(other) is AddrInfo - - Index: patches/patch-uvloop_handles_basetransport_pxd =================================================================== RCS file: patches/patch-uvloop_handles_basetransport_pxd diff -N patches/patch-uvloop_handles_basetransport_pxd --- patches/patch-uvloop_handles_basetransport_pxd 25 Aug 2024 00:31:48 -0000 1.1.1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,14 +0,0 @@ -Index: uvloop/handles/basetransport.pxd ---- uvloop/handles/basetransport.pxd.orig -+++ uvloop/handles/basetransport.pxd -@@ -47,8 +47,8 @@ cdef class UVBaseTransport(UVSocketHandle): - # === overloads === - - cdef _new_socket(self) -- cdef size_t _get_write_buffer_size(self) -+ cdef size_t _get_write_buffer_size(self) noexcept - -- cdef bint _is_reading(self) -+ cdef bint _is_reading(self) noexcept - cdef _start_reading(self) - cdef _stop_reading(self) Index: patches/patch-uvloop_handles_basetransport_pyx =================================================================== RCS file: patches/patch-uvloop_handles_basetransport_pyx diff -N patches/patch-uvloop_handles_basetransport_pyx --- patches/patch-uvloop_handles_basetransport_pyx 25 Aug 2024 00:31:48 -0000 1.1.1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,21 +0,0 @@ -Index: uvloop/handles/basetransport.pyx ---- uvloop/handles/basetransport.pyx.orig -+++ uvloop/handles/basetransport.pyx -@@ -18,7 +18,7 @@ cdef class UVBaseTransport(UVSocketHandle): - - self._closing = 0 - -- cdef size_t _get_write_buffer_size(self): -+ cdef size_t _get_write_buffer_size(self) noexcept: - return 0 - - cdef inline _schedule_call_connection_made(self): -@@ -211,7 +211,7 @@ cdef class UVBaseTransport(UVSocketHandle): - self._extra_info = {} - self._extra_info[name] = obj - -- cdef bint _is_reading(self): -+ cdef bint _is_reading(self) noexcept: - raise NotImplementedError - - cdef _start_reading(self): Index: patches/patch-uvloop_handles_handle_pyx =================================================================== RCS file: patches/patch-uvloop_handles_handle_pyx diff -N patches/patch-uvloop_handles_handle_pyx --- patches/patch-uvloop_handles_handle_pyx 25 Aug 2024 00:31:48 -0000 1.1.1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,12 +0,0 @@ -Index: uvloop/handles/handle.pyx ---- uvloop/handles/handle.pyx.orig -+++ uvloop/handles/handle.pyx -@@ -363,7 +363,7 @@ cdef void __uv_close_handle_cb(uv.uv_handle_t* handle) - Py_DECREF(h) # Was INCREFed in UVHandle._close - - --cdef void __close_all_handles(Loop loop): -+cdef void __close_all_handles(Loop loop) noexcept: - uv.uv_walk(loop.uvloop, - __uv_walk_close_all_handles_cb, - loop) # void Index: patches/patch-uvloop_handles_pipe_pyx =================================================================== RCS file: patches/patch-uvloop_handles_pipe_pyx diff -N patches/patch-uvloop_handles_pipe_pyx --- patches/patch-uvloop_handles_pipe_pyx 25 Aug 2024 00:31:48 -0000 1.1.1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,12 +0,0 @@ -Index: uvloop/handles/pipe.pyx ---- uvloop/handles/pipe.pyx.orig -+++ uvloop/handles/pipe.pyx -@@ -25,7 +25,7 @@ cdef __pipe_init_uv_handle(UVStream handle, Loop loop) - cdef __pipe_open(UVStream handle, int fd): - cdef int err - err = uv.uv_pipe_open(handle._handle, -- fd) -+ fd) - if err < 0: - exc = convert_error(err) - raise exc Index: patches/patch-uvloop_handles_poll_pxd =================================================================== RCS file: patches/patch-uvloop_handles_poll_pxd diff -N patches/patch-uvloop_handles_poll_pxd --- patches/patch-uvloop_handles_poll_pxd 25 Aug 2024 00:31:48 -0000 1.1.1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,12 +0,0 @@ -Index: uvloop/handles/poll.pxd ---- uvloop/handles/poll.pxd.orig -+++ uvloop/handles/poll.pxd -@@ -10,7 +10,7 @@ cdef class UVPoll(UVHandle): - cdef inline _poll_start(self, int flags) - cdef inline _poll_stop(self) - -- cdef int is_active(self) -+ cdef int is_active(self) noexcept - - cdef is_reading(self) - cdef is_writing(self) Index: patches/patch-uvloop_handles_poll_pyx =================================================================== RCS file: patches/patch-uvloop_handles_poll_pyx diff -N patches/patch-uvloop_handles_poll_pyx --- patches/patch-uvloop_handles_poll_pyx 25 Aug 2024 00:31:48 -0000 1.1.1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,12 +0,0 @@ -Index: uvloop/handles/poll.pyx ---- uvloop/handles/poll.pyx.orig -+++ uvloop/handles/poll.pyx -@@ -29,7 +29,7 @@ cdef class UVPoll(UVHandle): - handle._init(loop, fd) - return handle - -- cdef int is_active(self): -+ cdef int is_active(self) noexcept: - return (self.reading_handle is not None or - self.writing_handle is not None) - Index: patches/patch-uvloop_handles_stream_pyx =================================================================== RCS file: patches/patch-uvloop_handles_stream_pyx diff -N patches/patch-uvloop_handles_stream_pyx --- patches/patch-uvloop_handles_stream_pyx 25 Aug 2024 00:31:48 -0000 1.1.1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,58 +0,0 @@ -Index: uvloop/handles/stream.pyx ---- uvloop/handles/stream.pyx.orig -+++ uvloop/handles/stream.pyx -@@ -1,4 +1,8 @@ --DEF __PREALLOCED_BUFS = 4 -+cdef extern from *: -+ ''' -+ enum {__PREALLOCED_BUFS = 4}; -+ ''' -+ const bint __PREALLOCED_BUFS - - - @cython.no_gc_clear -@@ -279,7 +283,7 @@ cdef class UVStream(UVBaseTransport): - cdef inline _close_on_read_error(self): - self.__read_error_close = 1 - -- cdef bint _is_reading(self): -+ cdef bint _is_reading(self) noexcept: - return self.__reading - - cdef _start_reading(self): -@@ -578,7 +582,7 @@ cdef class UVStream(UVBaseTransport): - - self._maybe_resume_protocol() - -- cdef size_t _get_write_buffer_size(self): -+ cdef size_t _get_write_buffer_size(self) noexcept: - if self._handle is NULL: - return 0 - return ((self._handle).write_queue_size + -@@ -755,7 +759,7 @@ cdef inline bint __uv_stream_on_read_common( - UVStream sc, - Loop loop, - ssize_t nread, --): -+) noexcept: - if sc._closed: - # The stream was closed, there is no reason to - # do any work now. -@@ -818,7 +822,7 @@ cdef inline void __uv_stream_on_read_impl( - uv.uv_stream_t* stream, - ssize_t nread, - const uv.uv_buf_t* buf, --): -+) noexcept: - cdef: - UVStream sc = stream.data - Loop loop = sc._loop -@@ -849,7 +853,7 @@ cdef inline void __uv_stream_on_read_impl( - cdef inline void __uv_stream_on_write_impl( - uv.uv_write_t* req, - int status, --): -+) noexcept: - cdef: - _StreamWriteContext ctx = <_StreamWriteContext> req.data - UVStream stream = ctx.stream Index: patches/patch-uvloop_handles_udp_pyx =================================================================== RCS file: patches/patch-uvloop_handles_udp_pyx diff -N patches/patch-uvloop_handles_udp_pyx --- patches/patch-uvloop_handles_udp_pyx 25 Aug 2024 00:31:48 -0000 1.1.1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,18 +0,0 @@ -Index: uvloop/handles/udp.pyx ---- uvloop/handles/udp.pyx.orig -+++ uvloop/handles/udp.pyx -@@ -127,12 +127,12 @@ cdef class UDPTransport(UVBaseTransport): - exc = convert_error(err) - raise exc - -- cdef size_t _get_write_buffer_size(self): -+ cdef size_t _get_write_buffer_size(self) noexcept: - if self._handle is NULL: - return 0 - return (self._handle).send_queue_size - -- cdef bint _is_reading(self): -+ cdef bint _is_reading(self) noexcept: - return self.__receiving - - cdef _start_reading(self): Index: patches/patch-uvloop_includes_fork_handler_h =================================================================== RCS file: patches/patch-uvloop_includes_fork_handler_h diff -N patches/patch-uvloop_includes_fork_handler_h --- patches/patch-uvloop_includes_fork_handler_h 25 Aug 2024 00:31:48 -0000 1.1.1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,20 +0,0 @@ -Index: uvloop/includes/fork_handler.h ---- uvloop/includes/fork_handler.h.orig -+++ uvloop/includes/fork_handler.h -@@ -1,7 +1,10 @@ -+#ifndef UVLOOP_FORK_HANDLER_H_ -+#define UVLOOP_FORK_HANDLER_H_ -+ - volatile uint64_t MAIN_THREAD_ID = 0; - volatile int8_t MAIN_THREAD_ID_SET = 0; - --typedef void (*OnForkHandler)(); -+typedef void (*OnForkHandler)(void); - - OnForkHandler __forkHandler = NULL; - -@@ -36,3 +39,4 @@ void setMainThreadID(uint64_t id) { - MAIN_THREAD_ID = id; - MAIN_THREAD_ID_SET = 1; - } -+#endif Index: patches/patch-uvloop_includes_system_h =================================================================== RCS file: patches/patch-uvloop_includes_system_h diff -N patches/patch-uvloop_includes_system_h --- patches/patch-uvloop_includes_system_h 25 Aug 2024 00:31:48 -0000 1.1.1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,20 +0,0 @@ -Index: uvloop/includes/system.h ---- uvloop/includes/system.h.orig -+++ uvloop/includes/system.h -@@ -0,0 +1,16 @@ -+#ifndef UVLOOP_SYSTEM_H_ -+#define UVLOOP_SYSTEM_H_ -+#if defined(_WIN32) || defined(MS_WINDOWS) || defined(_MSC_VER) -+#include "Winsock2.h" -+#include "ws2def.h" -+#include "includes/fork_handler.h" -+#else -+#include "arpa/inet.h" -+#include "sys/socket.h" -+#include "sys/un.h" -+#include "unistd.h" -+#include "pthread.h" -+#endif -+#endif -+ -+ Index: patches/patch-uvloop_includes_system_pxd =================================================================== RCS file: patches/patch-uvloop_includes_system_pxd diff -N patches/patch-uvloop_includes_system_pxd --- patches/patch-uvloop_includes_system_pxd 25 Aug 2024 00:31:48 -0000 1.1.1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,21 +0,0 @@ -Index: uvloop/includes/system.pxd ---- uvloop/includes/system.pxd.orig -+++ uvloop/includes/system.pxd -@@ -1,13 +1,9 @@ - from libc.stdint cimport int8_t, uint64_t - --cdef extern from "arpa/inet.h" nogil: -- -- int ntohl(int) -- int htonl(int) -- int ntohs(int) -- -- --cdef extern from "sys/socket.h" nogil: -+cdef extern from "includes/system.h": -+ int ntohl(int) nogil -+ int htonl(int) nogil -+ int ntohs(int) nogil - - struct sockaddr: - unsigned short sa_family Index: patches/patch-uvloop_includes_uv_pxd =================================================================== RCS file: patches/patch-uvloop_includes_uv_pxd diff -N patches/patch-uvloop_includes_uv_pxd --- patches/patch-uvloop_includes_uv_pxd 25 Aug 2024 00:31:48 -0000 1.1.1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,30 +0,0 @@ -Index: uvloop/includes/uv.pxd ---- uvloop/includes/uv.pxd.orig -+++ uvloop/includes/uv.pxd -@@ -220,7 +220,7 @@ cdef extern from "uv.h" nogil: - UV_LEAVE_GROUP = 0, - UV_JOIN_GROUP - -- cpdef enum uv_fs_event: -+ cdef enum uv_fs_event: - UV_RENAME = 1, - UV_CHANGE = 2 - -@@ -282,7 +282,7 @@ cdef extern from "uv.h" nogil: - int uv_loop_close(uv_loop_t* loop) - int uv_loop_alive(uv_loop_t* loop) - int uv_loop_fork(uv_loop_t* loop) -- int uv_backend_fd(uv_loop_t* loop) -+ uv_os_fd_t uv_backend_fd(uv_loop_t* loop) - - void uv_update_time(uv_loop_t* loop) - uint64_t uv_now(const uv_loop_t*) -@@ -378,7 +378,7 @@ cdef extern from "uv.h" nogil: - # Pipes - - int uv_pipe_init(uv_loop_t* loop, uv_pipe_t* handle, int ipc) -- int uv_pipe_open(uv_pipe_t* handle, uv_file file) -+ int uv_pipe_open(uv_pipe_t* handle, uv_os_fd_t file) - int uv_pipe_bind(uv_pipe_t* handle, const char* name) - - void uv_pipe_connect(uv_connect_t* req, uv_pipe_t* handle, Index: patches/patch-uvloop_loop_pxd =================================================================== RCS file: patches/patch-uvloop_loop_pxd diff -N patches/patch-uvloop_loop_pxd --- patches/patch-uvloop_loop_pxd 25 Aug 2024 00:31:48 -0000 1.1.1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,52 +0,0 @@ -Index: uvloop/loop.pxd ---- uvloop/loop.pxd.orig -+++ uvloop/loop.pxd -@@ -1,15 +1,35 @@ - # cython: language_level=3 - -+cdef extern from *: -+ ''' -+ enum { UV_STREAM_RECV_BUF_SIZE = 256000, -+ SSL_READ_MAX_SIZE = 256 * 1024, // 250kb -+ }; -+ const float SSL_HANDSHAKE_TIMEOUT = 60.0; // Number of seconds to wait for SSL handshake to complete The default timeout matches that of Nginx. -+ const float SSL_SHUTDOWN_TIMEOUT = 30.0; // Number of seconds to wait for SSL shutdown to complete The default timeout mimics lingering_time -+ ''' -+ const bint UV_STREAM_RECV_BUF_SIZE -+ const bint SSL_READ_MAX_SIZE - --from .includes cimport uv --from .includes cimport system -+ const float SSL_HANDSHAKE_TIMEOUT -+ const float SSL_SHUTDOWN_TIMEOUT - --from libc.stdint cimport uint64_t, uint32_t, int64_t -+cdef enum: -+ FLOW_CONTROL_HIGH_WATER = 64 # KiB -+ FLOW_CONTROL_HIGH_WATER_SSL_READ = 256 # KiB -+ FLOW_CONTROL_HIGH_WATER_SSL_WRITE = 512 # KiB - -+ DNS_PYADDR_TO_SOCKADDR_CACHE_SIZE = 2048 -+ DEBUG_STACK_DEPTH = 10 -+ __PROCESS_DEBUG_SLEEP_AFTER_FORK = 1 -+ LOG_THRESHOLD_FOR_CONNLOST_WRITES = 5 - --include "includes/consts.pxi" - -+from .includes cimport uv -+from .includes cimport system - -+from libc.stdint cimport uint64_t, uint32_t, int64_t -+ - cdef extern from *: - ctypedef int vint "volatile int" - -@@ -200,7 +220,7 @@ cdef class Loop: - cdef inline _ceval_process_signals(self) - cdef _invoke_signals(self, bytes data) - -- cdef _set_coroutine_debug(self, bint enabled) -+ cpdef _set_coroutine_debug(self, bint enabled) - - cdef _print_debug_info(self) - Index: patches/patch-uvloop_loop_pyx =================================================================== RCS file: patches/patch-uvloop_loop_pyx diff -N patches/patch-uvloop_loop_pyx --- patches/patch-uvloop_loop_pyx 25 Aug 2024 00:31:48 -0000 1.1.1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,58 +0,0 @@ -Index: uvloop/loop.pyx ---- uvloop/loop.pyx.orig -+++ uvloop/loop.pyx -@@ -43,7 +43,7 @@ from cpython.pycapsule cimport PyCapsule_New, PyCapsul - from . import _noop - - --include "includes/consts.pxi" -+ - include "includes/stdlib.pxi" - - include "errors.pyx" -@@ -1118,7 +1118,7 @@ cdef class Loop: - - cdef _sock_set_reuseport(self, int fd): - cdef: -- int err -+ int err = 0 - int reuseport_flag = 1 - - err = system.setsockopt( -@@ -1131,7 +1131,7 @@ cdef class Loop: - if err < 0: - raise convert_error(-errno.errno) - -- cdef _set_coroutine_debug(self, bint enabled): -+ cpdef _set_coroutine_debug(self, bint enabled): - enabled = bool(enabled) - if self._coroutine_debug_set == enabled: - return -@@ -1396,8 +1396,7 @@ cdef class Loop: - def set_debug(self, enabled): - self._debug = bool(enabled) - if self.is_running(): -- self.call_soon_threadsafe( -- self._set_coroutine_debug, self, self._debug) -+ self.call_soon_threadsafe(self._set_coroutine_debug, self._debug) - - def is_running(self): - """Return whether the event loop is currently running.""" -@@ -2750,7 +2749,7 @@ cdef class Loop: - executable=None, - pass_fds=(), - # For tests only! Do not use in your code. Ever. -- __uvloop_sleep_after_fork=False): -+ uvloop_sleep_after_fork=False): - - # TODO: Implement close_fds (might not be very important in - # Python 3.5, since all FDs aren't inheritable by default.) -@@ -2770,7 +2769,7 @@ cdef class Loop: - if executable is not None: - args[0] = executable - -- if __uvloop_sleep_after_fork: -+ if uvloop_sleep_after_fork: - debug_flags |= __PROCESS_DEBUG_SLEEP_AFTER_FORK - - waiter = self._new_future() Index: patches/patch-uvloop_sslproto_pxd =================================================================== RCS file: patches/patch-uvloop_sslproto_pxd diff -N patches/patch-uvloop_sslproto_pxd --- patches/patch-uvloop_sslproto_pxd 25 Aug 2024 00:31:48 -0000 1.1.1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,19 +0,0 @@ -Index: uvloop/sslproto.pxd ---- uvloop/sslproto.pxd.orig -+++ uvloop/sslproto.pxd -@@ -122,7 +122,7 @@ cdef class SSLProtocol: - # Flow control for writes from APP socket - - cdef _control_app_writing(self, object context=*) -- cdef size_t _get_write_buffer_size(self) -+ cdef size_t _get_write_buffer_size(self) noexcept - cdef _set_write_buffer_limits(self, high=*, low=*) - - # Flow control for reads to APP socket -@@ -134,5 +134,5 @@ cdef class SSLProtocol: - - cdef _control_ssl_reading(self) - cdef _set_read_buffer_limits(self, high=*, low=*) -- cdef size_t _get_read_buffer_size(self) -+ cdef size_t _get_read_buffer_size(self) noexcept - cdef _fatal_error(self, exc, message=*) Index: patches/patch-uvloop_sslproto_pyx =================================================================== RCS file: patches/patch-uvloop_sslproto_pyx diff -N patches/patch-uvloop_sslproto_pyx --- patches/patch-uvloop_sslproto_pyx 25 Aug 2024 00:31:48 -0000 1.1.1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,21 +0,0 @@ -Index: uvloop/sslproto.pyx ---- uvloop/sslproto.pyx.orig -+++ uvloop/sslproto.pyx -@@ -861,7 +861,7 @@ cdef class SSLProtocol: - 'protocol': self, - }) - -- cdef size_t _get_write_buffer_size(self): -+ cdef size_t _get_write_buffer_size(self) noexcept: - return self._outgoing.pending + self._write_buffer_size - - cdef _set_write_buffer_limits(self, high=None, low=None): -@@ -903,7 +903,7 @@ cdef class SSLProtocol: - self._incoming_high_water = high - self._incoming_low_water = low - -- cdef size_t _get_read_buffer_size(self): -+ cdef size_t _get_read_buffer_size(self) noexcept: - return self._incoming.pending - - # Flow control for writes to SSL socket