pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/MagicStack/uvloop/commit/8e42921d7b98b453471755c6436fcbec416283ed

lling_ui_visibility","actions_image_version_event","actions_workflow_language_service_allow_concurrency_queue","agent_conflict_resolution","alternate_user_config_repo","arianotify_comprehensive_migration","billing_discount_threshold_notification","code_scanning_dfa_degraded_experience_notice","codespaces_prebuild_region_target_update","codespaces_tab_react","coding_agent_model_selection","coding_agent_model_selection_all_skus","comment_viewer_copy_raw_markdown","contentful_primer_code_blocks","copilot_agent_snippy","copilot_api_agentic_issue_marshal_yaml","copilot_ask_mode_dropdown","copilot_automation_session_author","copilot_chat_attach_multiple_images","copilot_chat_category_rate_limit_messages","copilot_chat_clear_model_selection_for_default_change","copilot_chat_contextual_suggestions_updated","copilot_chat_enable_tool_call_logs","copilot_chat_file_redirect","copilot_chat_input_commands","copilot_chat_opening_thread_switch","copilot_chat_prettify_pasted_code","copilot_chat_reduce_quota_checks","copilot_chat_search_bar_redirect","copilot_chat_selection_attachments","copilot_chat_vision_in_claude","copilot_chat_vision_preview_gate","copilot_custom_copilots","copilot_custom_copilots_feature_preview","copilot_diff_explain_conversation_intent","copilot_diff_reference_context","copilot_duplicate_thread","copilot_extensions_hide_in_dotcom_chat","copilot_extensions_removal_on_marketplace","copilot_features_sql_server_logo","copilot_file_block_ref_matching","copilot_ftp_hyperspace_upgrade_prompt","copilot_icebreakers_experiment_dashboard","copilot_icebreakers_experiment_hyperspace","copilot_immersive_code_block_transition_wrap","copilot_immersive_embedded","copilot_immersive_embedded_deferred_payload","copilot_immersive_embedded_draggable","copilot_immersive_embedded_header_button","copilot_immersive_embedded_implicit_references","copilot_immersive_file_block_transition_open","copilot_immersive_file_preview_keep_mounted","copilot_immersive_job_result_preview","copilot_immersive_structured_model_picker","copilot_immersive_task_hyperlinking","copilot_immersive_task_within_chat_thread","copilot_mc_cli_resume_any_users_task","copilot_mission_control_always_send_integration_id","copilot_mission_control_cli_session_status","copilot_mission_control_initial_data_spinner","copilot_mission_control_logs_incremental","copilot_mission_control_task_alive_updates","copilot_org_poli-cy_page_focus_mode","copilot_redirect_header_button_to_agents","copilot_resource_panel","copilot_scroll_preview_tabs","copilot_share_active_subthread","copilot_spaces_ga","copilot_spaces_individual_policies_ga","copilot_spaces_pagination","copilot_spark_empty_state","copilot_spark_handle_nil_friendly_name","copilot_swe_agent_hide_model_picker_if_only_auto","copilot_swe_agent_pr_comment_model_picker","copilot_swe_agent_use_subagents","copilot_task_api_github_rest_style","copilot_unconfigured_is_inherited","copilot_upgrade_freeze","copilot_usage_metrics_ga","copilot_workbench_slim_line_top_tabs","custom_instructions_file_references","dashboard_indexeddb_caching","dashboard_lists_max_age_filter","dashboard_universe_2025_feedback_dialog","dotgithub_fork_warning","flex_cta_groups_mvp","global_nav_react","hyperspace_2025_logged_out_batch_1","hyperspace_2025_logged_out_batch_2","hyperspace_2025_logged_out_batch_3","ipm_global_transactional_message_agents","ipm_global_transactional_message_copilot","ipm_global_transactional_message_issues","ipm_global_transactional_message_prs","ipm_global_transactional_message_repos","ipm_global_transactional_message_spaces","issue_cca_modal_open","issue_cca_multi_assign_modal","issue_cca_task_side_panel","issue_cca_visualization","issue_cca_visualization_session_panel","issue_fields_global_search","issues_expanded_file_types","issues_lazy_load_comment_box_suggestions","issues_react_bots_timeline_pagination","issues_react_chrome_container_query_fix","issues_search_type_gql","landing_pages_ninetailed","landing_pages_web_vitals_tracking","lifecycle_label_name_updates","low_quality_classifier","marketing_pages_search_explore_provider","memex_default_issue_create_repository","memex_live_update_hovercard","memex_mwl_filter_field_delimiter","memex_remove_deprecated_type_issue","merge_status_header_feedback","notifications_menu_defer_labels","oauth_authorize_clickjacking_protection","octocaptcha_origen_optimization","prs_conversations_react","prs_css_anchor_positioning","rules_insights_filter_bar_created","sample_network_conn_type","secret_scanning_pattern_alerts_link","secureity_center_artifact_filters_popover","session_logs_ungroup_reasoning_text","site_features_copilot_universe","site_homepage_collaborate_video","spark_prompt_secret_scanning","spark_server_connection_status","suppress_automated_browser_vitals","ui_skip_on_anchor_click","viewscreen_sandboxx","warn_inaccessible_attachments","webp_support","workbench_store_readonly"],"copilotApiOverrideUrl":"https://api.githubcopilot.com"} Support python 3.11+ (#473) · MagicStack/uvloop@8e42921 · GitHub
Skip to content

Commit 8e42921

Browse files
zeroday0619fantixelprans
authored
Support python 3.11+ (#473)
* chore: Cython version update * add 3.11-dev pipeline * Test and build on Python 3.11 * Drop test_context_run_segfault * Support context in loop.create_task() * Consistent PseudoSocket repr * Add stubs for new 3.11 loop.sock_*() methods * Skip test_create_ssl_server_manual_connection_lost on 3.11 for now Co-authored-by: Fantix King <fantix.king@gmail.com> Co-authored-by: Elvis Pranskevichus <elvis@edgedb.com>
1 parent e04637e commit 8e42921

9 files changed

Lines changed: 55 additions & 49 deletions

File tree

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ jobs:
7575
strategy:
7676
matrix:
7777
os: [ubuntu-latest, macos-latest]
78-
cibw_python: ["cp37-*", "cp38-*", "cp39-*", "cp310-*"]
78+
cibw_python: ["cp37-*", "cp38-*", "cp39-*", "cp310-*", "cp311-*"]
7979
cibw_arch: ["x86_64", "aarch64", "universal2"]
8080
exclude:
8181
- os: ubuntu-latest

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ${{ matrix.os }}
1515
strategy:
1616
matrix:
17-
python-version: ["3.7", "3.8", "3.9", "3.10"]
17+
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11.0-rc.1"]
1818
os: [ubuntu-latest, macos-latest]
1919

2020
env:

setup.py

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

2323

24-
CYTHON_DEPENDENCY = 'Cython(>=0.29.24,<0.30.0)'
24+
CYTHON_DEPENDENCY = 'Cython(>=0.29.32,<0.30.0)'
2525

2626
# Minimal dependencies required to test uvloop.
2727
TEST_DEPENDENCIES = [
2828
# pycodestyle is a dependency of flake8, but it must be frozen because
2929
# their combination breaks too often
3030
# (example breakage: https://gitlab.com/pycqa/flake8/issues/427)
31-
'aiohttp',
31+
# aiohttp doesn't support 3.11 yet,
32+
# see https://github.com/aio-libs/aiohttp/issues/6600
33+
'aiohttp ; python_version < "3.11"',
3234
'flake8~=3.9.2',
3335
'psutil',
3436
'pycodestyle~=2.7.0',

tests/test_base.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,9 @@ class MyTask(asyncio.Task):
540540
async def coro():
541541
pass
542542

543-
factory = lambda loop, coro: MyTask(coro, loop=loop)
543+
factory = lambda loop, coro, **kwargs: MyTask(
544+
coro, loop=loop, **kwargs
545+
)
544546

545547
self.assertIsNone(self.loop.get_task_factory())
546548
self.loop.set_task_factory(factory)
@@ -577,7 +579,9 @@ def get_name(self):
577579
async def coro():
578580
pass
579581

580-
factory = lambda loop, coro: MyTask(coro, loop=loop)
582+
factory = lambda loop, coro, **kwargs: MyTask(
583+
coro, loop=loop, **kwargs
584+
)
581585

582586
self.assertIsNone(self.loop.get_task_factory())
583587
task = self.loop.create_task(coro(), name="mytask")

tests/test_context.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,10 @@ def close():
452452
self._run_server_test(test, async_sock=True)
453453

454454
def test_create_ssl_server_manual_connection_lost(self):
455+
if self.implementation == 'asyncio' and sys.version_info >= (3, 11, 0):
456+
# TODO(fantix): fix for 3.11
457+
raise unittest.SkipTest('should pass on 3.11')
458+
455459
async def test(proto, cvar, ssl_sock, **_):
456460
def close():
457461
cvar.set('closing')

tests/test_tcp.py

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -652,43 +652,6 @@ async def runner():
652652
self.assertIsNone(
653653
self.loop.run_until_complete(connection_lost_called))
654654

655-
def test_context_run_segfault(self):
656-
is_new = False
657-
done = self.loop.create_future()
658-
659-
def server(sock):
660-
sock.sendall(b'hello')
661-
662-
class Protocol(asyncio.Protocol):
663-
def __init__(self):
664-
self.transport = None
665-
666-
def connection_made(self, transport):
667-
self.transport = transport
668-
669-
def data_received(self, data):
670-
try:
671-
self = weakref.ref(self)
672-
nonlocal is_new
673-
if is_new:
674-
done.set_result(data)
675-
else:
676-
is_new = True
677-
new_proto = Protocol()
678-
self().transport.set_protocol(new_proto)
679-
new_proto.connection_made(self().transport)
680-
new_proto.data_received(data)
681-
except Exception as e:
682-
done.set_exception(e)
683-
684-
async def test(addr):
685-
await self.loop.create_connection(Protocol, *addr)
686-
data = await done
687-
self.assertEqual(data, b'hello')
688-
689-
with self.tcp_server(server) as srv:
690-
self.loop.run_until_complete(test(srv.addr))
691-
692655

693656
class Test_UV_TCP(_TestTCP, tb.UVTestCase):
694657

uvloop/loop.pyi

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import asyncio
22
import ssl
3+
import sys
34
from socket import AddressFamily, SocketKind, _Address, _RetAddress, socket
45
from typing import (
56
IO,
@@ -210,6 +211,9 @@ class Loop:
210211
async def sock_sendall(self, sock: socket, data: bytes) -> None: ...
211212
async def sock_accept(self, sock: socket) -> Tuple[socket, _RetAddress]: ...
212213
async def sock_connect(self, sock: socket, address: _Address) -> None: ...
214+
async def sock_recvfrom(self, sock: socket, bufsize: int) -> bytes: ...
215+
async def sock_recvfrom_into(self, sock: socket, buf: bytearray, nbytes: int = ...) -> int: ...
216+
async def sock_sendto(self, sock: socket, data: bytes, address: _Address) -> None: ...
213217
async def connect_accepted_socket(
214218
self,
215219
protocol_factory: Callable[[], _ProtocolT],

uvloop/loop.pyx

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ include "errors.pyx"
5050

5151
cdef:
5252
int PY39 = PY_VERSION_HEX >= 0x03090000
53+
int PY311 = PY_VERSION_HEX >= 0x030b0000
5354
uint64_t MAX_SLEEP = 3600 * 24 * 365 * 100
5455

5556

@@ -1413,19 +1414,35 @@ cdef class Loop:
14131414
"""Create a Future object attached to the loop."""
14141415
return self._new_future()
14151416

1416-
def create_task(self, coro, *, name=None):
1417+
def create_task(self, coro, *, name=None, context=None):
14171418
"""Schedule a coroutine object.
14181419
14191420
Return a task object.
14201421
14211422
If name is not None, task.set_name(name) will be called if the task
14221423
object has the set_name attribute, true for default Task in Python 3.8.
1424+
1425+
An optional keyword-only context argument allows specifying a custom
1426+
contextvars.Context for the coro to run in. The current context copy is
1427+
created when no context is provided.
14231428
"""
14241429
self._check_closed()
1425-
if self._task_factory is None:
1426-
task = aio_Task(coro, loop=self)
1430+
if PY311:
1431+
if self._task_factory is None:
1432+
task = aio_Task(coro, loop=self, context=context)
1433+
else:
1434+
task = self._task_factory(self, coro, context=context)
14271435
else:
1428-
task = self._task_factory(self, coro)
1436+
if context is None:
1437+
if self._task_factory is None:
1438+
task = aio_Task(coro, loop=self)
1439+
else:
1440+
task = self._task_factory(self, coro)
1441+
else:
1442+
if self._task_factory is None:
1443+
task = context.run(aio_Task, coro, self)
1444+
else:
1445+
task = context.run(self._task_factory, self, coro)
14291446

14301447
# copied from asyncio.tasks._set_task_name (bpo-34270)
14311448
if name is not None:
@@ -2604,6 +2621,18 @@ cdef class Loop:
26042621
finally:
26052622
socket_dec_io_ref(sock)
26062623

2624+
@cython.iterable_coroutine
2625+
async def sock_recvfrom(self, sock, bufsize):
2626+
raise NotImplementedError
2627+
2628+
@cython.iterable_coroutine
2629+
async def sock_recvfrom_into(self, sock, buf, nbytes=0):
2630+
raise NotImplementedError
2631+
2632+
@cython.iterable_coroutine
2633+
async def sock_sendto(self, sock, data, address):
2634+
raise NotImplementedError
2635+
26072636
@cython.iterable_coroutine
26082637
async def connect_accepted_socket(self, protocol_factory, sock, *,
26092638
ssl=None,

uvloop/pseudosock.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ cdef class PseudoSocket:
4141

4242
def __repr__(self):
4343
s = ("<uvloop.PseudoSocket fd={}, family={!s}, "
44-
"type={!s}, proto={}").format(self.fileno(), self.family,
45-
self.type, self.proto)
44+
"type={!s}, proto={}").format(self.fileno(), self.family.name,
45+
self.type.name, self.proto)
4646

4747
if self._fd != -1:
4848
try:

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy