8000 GH-91166: zero copy SelectorSocketTransport transport implementation by kumaraditya303 · Pull Request #31871 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

GH-91166: zero copy SelectorSocketTransport transport implementation #31871

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

Merged
merged 23 commits into from
Dec 24, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix check on other platforms
  • Loading branch information
kumaraditya303 authored Oct 24, 2022
commit d6c77cd63ac0c541df5df1b9346d1ccb75ce40fd
6 changes: 5 additions & 1 deletion Lib/asyncio/selector_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@
HAVE_SENDMSG = hasattr(socket.socket, 'sendmsg')

if HAVE_SENDMSG:
SC_IOV_MAX = os.sysconf('SC_IOV_MAX')
try:
SC_IOV_MAX = os.sysconf('SC_IOV_MAX')
except OSError:
# Fallback to send
HAVE_SENDMSG = False

def _test_selector_event(selector, fd, event):
# Test if the selector is monitoring 'event' events
Expand Down
17 changes: 9 additions & 8 deletions Lib/test/test_asyncio/test_selector_events.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
"""Tests for selector_events.py"""

import collections
import sys
import selectors
import socket
import sys
import unittest
from asyncio import selector_events
from unittest import mock

try:
import ssl
except ImportError:
ssl = None

import asyncio
from asyncio.selector_events import BaseSelectorEventLoop
from asyncio.selector_events import _SelectorTransport
from asyncio.selector_events import _SelectorSocketTransport
from asyncio.selector_events import _SelectorDatagramTransport
from asyncio.selector_events import (BaseSelectorEventLoop,
_SelectorDatagramTransport,
_SelectorSocketTransport,
_SelectorTransport)
from test.test_asyncio import utils as test_utils


MOCK_ANY = mock.ANY


Expand Down Expand Up @@ -746,7 +747,7 @@ def test_write_sendmsg_no_data(self):
self.assertFalse(self.sock.sendmsg.called)
self.assertEqual(list_to_buffer([b'data']), transport._buffer)

@unittest.skipUnless(hasattr(socket.socket, 'sendmsg'), 'no sendmsg')
@unittest.skipUnless(selector_events.HAVE_SENDMSG, 'no sendmsg')
def test_write_sendmsg_full(self):
data = memoryview(b'data')
self.sock.sendmsg = mock.Mock()
Expand All @@ -759,7 +760,7 @@ def test_write_sendmsg_full(self):
self.assertTrue(self.sock.sendmsg.called)
self.assertFalse(self.loop.writers)

@unittest.skipUnless(hasattr(socket.socket, 'sendmsg'), 'no sendmsg')
@unittest.skipUnless(selector_events.HAVE_SENDMSG, 'no sendmsg')
def test_write_sendmsg_partial(self):

data = memoryview(b'data')
Expand Down
0