Skip to content

Commit d3e0314

Browse files
authored
Merge branch 'master' into optimize_ssl_nonbuffered_read
2 parents b771722 + 0582f94 commit d3e0314

5 files changed

Lines changed: 26 additions & 3 deletions

File tree

examples/bench/echoclient.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,15 @@
44

55
import argparse
66
import concurrent.futures
7+
import multiprocessing
78
import socket
89
import ssl
910
import time
1011

1112

1213
if __name__ == '__main__':
14+
multiprocessing.set_start_method("fork")
15+
1316
parser = argparse.ArgumentParser()
1417
parser.add_argument('--msize', default=1000, type=int,
1518
help='message size in bytes')

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ docs = [
5959
requires = [
6060
"packaging>=20",
6161
"setuptools>=60",
62-
"wheel",
6362
"Cython~=3.1",
6463
]
6564
build-backend = "setuptools.build_meta"

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import pathlib
1313
import platform
1414
import re
15+
import shlex
1516
import shutil
1617
import subprocess
1718
import sys
@@ -23,7 +24,7 @@
2324

2425
CYTHON_DEPENDENCY = 'Cython~=3.1'
2526
MACHINE = platform.machine()
26-
MODULES_CFLAGS = [os.getenv('UVLOOP_OPT_CFLAGS', '-O2')]
27+
MODULES_CFLAGS = shlex.split(os.getenv('UVLOOP_OPT_CFLAGS', '-O2'))
2728
_ROOT = pathlib.Path(__file__).parent
2829
LIBUV_DIR = str(_ROOT / 'vendor' / 'libuv')
2930
LIBUV_BUILD_DIR = str(_ROOT / 'build' / 'libuv-{}'.format(MACHINE))

tests/test_base.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -799,6 +799,26 @@ async def main():
799799
elif result.returncode != 0:
800800
self.fail(result.stdout.strip())
801801

802+
def test_thread_name_prefix_in_default_executor(self):
803+
if self.implementation == "asyncio" and sys.version_info < (3, 9):
804+
raise unittest.SkipTest(
805+
"thread_name_prefix was added in CPython 3.9"
806+
)
807+
808+
called = []
809+
810+
def cb():
811+
called.append(threading.current_thread().name)
812+
813+
async def runner():
814+
await self.loop.run_in_executor(None, cb)
815+
816+
self.loop.run_until_complete(runner())
817+
818+
self.assertEqual(len(called), 1)
819+
self.assertTrue(called[0] is not None)
820+
self.assertTrue(called[0].startswith(self.implementation))
821+
802822

803823
class TestBaseUV(_TestBase, UVTestCase):
804824

uvloop/loop.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2754,7 +2754,7 @@ cdef class Loop:
27542754
# Only check when the default executor is being used
27552755
self._check_default_executor()
27562756
if executor is None:
2757-
executor = cc_ThreadPoolExecutor()
2757+
executor = cc_ThreadPoolExecutor(thread_name_prefix='uvloop')
27582758
self._default_executor = executor
27592759

27602760
return aio_wrap_future(executor.submit(func, *args), loop=self)

0 commit comments

Comments
 (0)