Skip to content

Commit 96dc94c

Browse files
author
taras
committed
Merge remote-tracking branch 'origin/master' into optimize_write_latency
2 parents cfa33ab + 3fba9fa commit 96dc94c

File tree

15 files changed

+76
-50
lines changed

15 files changed

+76
-50
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ _default: compile
99

1010

1111
clean:
12-
rm -fr dist/ doc/_build/ *.egg-info uvloop/loop.*.pyd
12+
rm -fr dist/ doc/_build/ *.egg-info uvloop/loop.*.pyd uvloop/loop_d.*.pyd
1313
rm -fr uvloop/*.c uvloop/*.html uvloop/*.so
1414
rm -fr uvloop/handles/*.html uvloop/includes/*.html
1515
find . -name '__pycache__' | xargs rm -rf

pyproject.toml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,16 @@ test = [
3636
# pycodestyle is a dependency of flake8, but it must be frozen because
3737
# their combination breaks too often
3838
# (example breakage: https://gitlab.com/pycqa/flake8/issues/427)
39-
'aiohttp>=3.8.1; python_version < "3.12"',
40-
'aiohttp==3.9.0b0; python_version >= "3.12"',
39+
'aiohttp>=3.10.5',
4140
'flake8~=5.0',
4241
'psutil',
4342
'pycodestyle~=2.9.0',
4443
'pyOpenSSL~=23.0.0',
4544
'mypy>=0.800',
46-
'Cython(>=0.29.36,<0.30.0)',
45+
]
46+
dev = [
47+
'setuptools>=60',
48+
'Cython~=3.0',
4749
]
4850
docs = [
4951
'Sphinx~=4.1.2',
@@ -55,7 +57,7 @@ docs = [
5557
requires = [
5658
"setuptools>=60",
5759
"wheel",
58-
"Cython(>=0.29.36,<0.30.0)",
60+
"Cython~=3.0",
5961
]
6062
build-backend = "setuptools.build_meta"
6163

setup.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from setuptools.command.sdist import sdist
2222

2323

24-
CYTHON_DEPENDENCY = 'Cython(>=0.29.36,<0.30.0)'
24+
CYTHON_DEPENDENCY = 'Cython~=3.0'
2525
MACHINE = platform.machine()
2626
MODULES_CFLAGS = [os.getenv('UVLOOP_OPT_CFLAGS', '-O2')]
2727
_ROOT = pathlib.Path(__file__).parent
@@ -144,7 +144,9 @@ def finalize_options(self):
144144
self.distribution.ext_modules[:] = cythonize(
145145
self.distribution.ext_modules,
146146
compiler_directives=directives,
147-
annotate=self.cython_annotate)
147+
annotate=self.cython_annotate,
148+
compile_time_env=dict(DEFAULT_FREELIST_SIZE=250),
149+
emit_linenums=self.debug)
148150

149151
super().finalize_options()
150152

tests/test_tcp.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1626,17 +1626,22 @@ async def client(addr):
16261626
self.fail("unexpected call to connection_made()")
16271627

16281628
def test_ssl_connect_accepted_socket(self):
1629-
if hasattr(ssl, 'PROTOCOL_TLS'):
1630-
proto = ssl.PROTOCOL_TLS
1629+
if hasattr(ssl, 'PROTOCOL_TLS_SERVER'):
1630+
server_proto = ssl.PROTOCOL_TLS_SERVER
1631+
client_proto = ssl.PROTOCOL_TLS_CLIENT
16311632
else:
1632-
proto = ssl.PROTOCOL_SSLv23
1633-
server_context = ssl.SSLContext(proto)
1633+
if hasattr(ssl, 'PROTOCOL_TLS'):
1634+
client_proto = server_proto = ssl.PROTOCOL_TLS
1635+
else:
1636+
client_proto = server_proto = ssl.PROTOCOL_SSLv23
1637+
1638+
server_context = ssl.SSLContext(server_proto)
16341639
server_context.load_cert_chain(self.ONLYCERT, self.ONLYKEY)
16351640
if hasattr(server_context, 'check_hostname'):
16361641
server_context.check_hostname = False
16371642
server_context.verify_mode = ssl.CERT_NONE
16381643

1639-
client_context = ssl.SSLContext(proto)
1644+
client_context = ssl.SSLContext(client_proto)
16401645
if hasattr(server_context, 'check_hostname'):
16411646
client_context.check_hostname = False
16421647
client_context.verify_mode = ssl.CERT_NONE
@@ -2229,8 +2234,7 @@ def test_renegotiation(self):
22292234
sslctx.use_privatekey_file(self.ONLYKEY)
22302235
sslctx.use_certificate_chain_file(self.ONLYCERT)
22312236
client_sslctx = self._create_client_ssl_context()
2232-
if hasattr(ssl, 'OP_NO_TLSv1_3'):
2233-
client_sslctx.options |= ssl.OP_NO_TLSv1_3
2237+
client_sslctx.maximum_version = ssl.TLSVersion.TLSv1_2
22342238

22352239
def server(sock):
22362240
conn = openssl_ssl.Connection(sslctx, sock)
@@ -2588,8 +2592,7 @@ def test_flush_before_shutdown(self):
25882592
sslctx_openssl.use_privatekey_file(self.ONLYKEY)
25892593
sslctx_openssl.use_certificate_chain_file(self.ONLYCERT)
25902594
client_sslctx = self._create_client_ssl_context()
2591-
if hasattr(ssl, 'OP_NO_TLSv1_3'):
2592-
client_sslctx.options |= ssl.OP_NO_TLSv1_3
2595+
client_sslctx.maximum_version = ssl.TLSVersion.TLSv1_2
25932596

25942597
future = None
25952598

uvloop/_testbase.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,9 @@ def find_free_port(start_from=50000):
269269
class SSLTestCase:
270270

271271
def _create_server_ssl_context(self, certfile, keyfile=None):
272-
if hasattr(ssl, 'PROTOCOL_TLS'):
272+
if hasattr(ssl, 'PROTOCOL_TLS_SERVER'):
273+
sslcontext = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
274+
elif hasattr(ssl, 'PROTOCOL_TLS'):
273275
sslcontext = ssl.SSLContext(ssl.PROTOCOL_TLS)
274276
else:
275277
sslcontext = ssl.SSLContext(ssl.PROTOCOL_SSLv23)

uvloop/dns.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ cdef class AddrInfo:
298298
uv.uv_freeaddrinfo(self.data) # returns void
299299
self.data = NULL
300300

301-
cdef void set_data(self, system.addrinfo *data):
301+
cdef void set_data(self, system.addrinfo *data) noexcept:
302302
self.data = data
303303

304304
cdef unpack(self):

uvloop/handles/handle.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ cdef void __uv_close_handle_cb(uv.uv_handle_t* handle) noexcept with gil:
363363
Py_DECREF(h) # Was INCREFed in UVHandle._close
364364

365365

366-
cdef void __close_all_handles(Loop loop):
366+
cdef void __close_all_handles(Loop loop) noexcept:
367367
uv.uv_walk(loop.uvloop,
368368
__uv_walk_close_all_handles_cb,
369369
<void*>loop) # void

uvloop/handles/pipe.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ cdef __pipe_init_uv_handle(UVStream handle, Loop loop):
2525
cdef __pipe_open(UVStream handle, int fd):
2626
cdef int err
2727
err = uv.uv_pipe_open(<uv.uv_pipe_t *>handle._handle,
28-
<uv.uv_file>fd)
28+
<uv.uv_os_fd_t>fd)
2929
if err < 0:
3030
exc = convert_error(err)
3131
raise exc

uvloop/handles/poll.pxd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ cdef class UVPoll(UVHandle):
1010
cdef inline _poll_start(self, int flags)
1111
cdef inline _poll_stop(self)
1212

13-
cdef int is_active(self)
13+
cdef int is_active(self) noexcept
1414

1515
cdef is_reading(self)
1616
cdef is_writing(self)

uvloop/handles/poll.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ cdef class UVPoll(UVHandle):
2929
handle._init(loop, fd)
3030
return handle
3131

32-
cdef int is_active(self):
32+
cdef int is_active(self) noexcept:
3333
return (self.reading_handle is not None or
3434
self.writing_handle is not None)
3535

0 commit comments

Comments
 (0)