Bug 2069168 - python-aiohttp fails to build with Python 3.11: RuntimeError: There is no current event loop in thread 'MainThread'.
Summary: python-aiohttp fails to build with Python 3.11: RuntimeError: There is no cur...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: python-aiohttp
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Fabian Affolter
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.11
TreeView+ depends on / blocked
 
Reported: 2022-03-28 12:12 UTC by Tomáš Hrnčiar
Modified: 2022-06-22 11:49 UTC (History)
6 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2022-06-22 11:49:14 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github aio-libs aiohttp issues 6730 0 None open Python 3.11 - error: _PyErr_StackItem {aka struct _err_stackitem} has no member named exc_type/exc_traceback 2022-05-02 11:43:34 UTC

Description Tomáš Hrnčiar 2022-03-28 12:12:00 UTC
python-aiohttp fails to build with Python 3.11.0a6.

aiohttp/_http_writer.c: In function ‘__Pyx_ReraiseException’:
aiohttp/_http_writer.c:4736:20: error: ‘_PyErr_StackItem’ {aka ‘struct _err_stackitem’} has no member named ‘exc_type’
 4736 |     type = exc_info->exc_type;
      |                    ^~
aiohttp/_http_writer.c:4738:18: error: ‘_PyErr_StackItem’ {aka ‘struct _err_stackitem’} has no member named ‘exc_traceback’
 4738 |     tb = exc_info->exc_traceback;
      |                  ^~

The interpreter state’s representation of handled exceptions (a.k.a exc_info, or _PyErr_StackItem) now has only the exc_value field, exc_type and exc_traceback have been removed as their values can be derived from exc_value. (Contributed by Irit Katriel in bpo-45711.)

https://bugs.python.org/issue45711
https://docs.python.org/3.11/whatsnew/3.11.html

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.11/fedora-rawhide-x86_64/03844237-python-aiohttp/

For all our attempts to build python-aiohttp with Python 3.11, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.11/package/python-aiohttp/

Testing and mass rebuild of packages is happening in copr. You can follow these instructions to test locally in mock if your package builds with Python 3.11:
https://copr.fedorainfracloud.org/coprs/g/python/python3.11/

Let us know here if you have any questions.

Python 3.11 is planned to be included in Fedora 37. To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.11.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires), so if this package is required a lot, it's important for us to get it fixed soon.
We'd appreciate help from the people who know this package best, but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 1 Tomáš Hrnčiar 2022-05-16 07:03:50 UTC
Since the 1st beta the above problem has changed.

=================================== FAILURES ===================================
___________________ test_timeout_on_reading_headers[pyloop] ____________________

self = <aiohttp.client.ClientSession object at 0x7f1fc7ec4d50>, method = 'GET'
str_or_url = URL('http://127.0.0.1:46329/')

    async def _request(
        self,
        method: str,
        str_or_url: StrOrURL,
        *,
        params: Optional[Mapping[str, str]] = None,
        data: Any = None,
        json: Any = None,
        cookies: Optional[LooseCookies] = None,
        headers: Optional[LooseHeaders] = None,
        skip_auto_headers: Optional[Iterable[str]] = None,
        auth: Optional[BasicAuth] = None,
        allow_redirects: bool = True,
        max_redirects: int = 10,
        compress: Optional[str] = None,
        chunked: Optional[bool] = None,
        expect100: bool = False,
        raise_for_status: Optional[bool] = None,
        read_until_eof: bool = True,
        proxy: Optional[StrOrURL] = None,
        proxy_auth: Optional[BasicAuth] = None,
        timeout: Union[ClientTimeout, object] = sentinel,
        verify_ssl: Optional[bool] = None,
        fingerprint: Optional[bytes] = None,
        ssl_context: Optional[SSLContext] = None,
        ssl: Optional[Union[SSLContext, bool, Fingerprint]] = None,
        proxy_headers: Optional[LooseHeaders] = None,
        trace_request_ctx: Optional[SimpleNamespace] = None,
        read_bufsize: Optional[int] = None,
    ) -> ClientResponse:
    
        # NOTE: timeout clamps existing connect and read timeouts.  We cannot
        # set the default to None because we need to detect if the user wants
        # to use the existing timeouts by setting timeout to None.
    
        if self.closed:
            raise RuntimeError("Session is closed")
    
        ssl = _merge_ssl_params(ssl, verify_ssl, ssl_context, fingerprint)
    
        if data is not None and json is not None:
            raise ValueError(
                "data and json parameters can not be used at the same time"
            )
        elif json is not None:
            data = payload.JsonPayload(json, dumps=self._json_serialize)
    
        if not isinstance(chunked, bool) and chunked is not None:
            warnings.warn("Chunk size is deprecated #1615", DeprecationWarning)
    
        redirects = 0
        history = []
        version = self._version
    
        # Merge with default headers and transform to CIMultiDict
        headers = self._prepare_headers(headers)
        proxy_headers = self._prepare_headers(proxy_headers)
    
        try:
            url = self._build_url(str_or_url)
        except ValueError as e:
            raise InvalidURL(str_or_url) from e
    
        skip_headers = set(self._skip_auto_headers)
        if skip_auto_headers is not None:
            for i in skip_auto_headers:
                skip_headers.add(istr(i))
    
        if proxy is not None:
            try:
                proxy = URL(proxy)
            except ValueError as e:
                raise InvalidURL(proxy) from e
    
        if timeout is sentinel:
            real_timeout = self._timeout  # type: ClientTimeout
        else:
            if not isinstance(timeout, ClientTimeout):
                real_timeout = ClientTimeout(total=timeout)  # type: ignore[arg-type]
            else:
                real_timeout = timeout
        # timeout is cumulative for all request operations
        # (request, redirects, responses, data consuming)
        tm = TimeoutHandle(self._loop, real_timeout.total)
        handle = tm.start()
    
        if read_bufsize is None:
            read_bufsize = self._read_bufsize
    
        traces = [
            Trace(
                self,
                trace_config,
                trace_config.trace_config_ctx(trace_request_ctx=trace_request_ctx),
            )
            for trace_config in self._trace_configs
        ]
    
        for trace in traces:
            await trace.send_request_start(method, url.update_query(params), headers)
    
        timer = tm.timer()
        try:
            with timer:
                while True:
                    url, auth_from_url = strip_auth_from_url(url)
                    if auth and auth_from_url:
                        raise ValueError(
                            "Cannot combine AUTH argument with "
                            "credentials encoded in URL"
                        )
    
                    if auth is None:
                        auth = auth_from_url
                    if auth is None:
                        auth = self._default_auth
                    # It would be confusing if we support explicit
                    # Authorization header with auth argument
                    if (
                        headers is not None
                        and auth is not None
                        and hdrs.AUTHORIZATION in headers
                    ):
                        raise ValueError(
                            "Cannot combine AUTHORIZATION header "
                            "with AUTH argument or credentials "
                            "encoded in URL"
                        )
    
                    all_cookies = self._cookie_jar.filter_cookies(url)
    
                    if cookies is not None:
                        tmp_cookie_jar = CookieJar()
                        tmp_cookie_jar.update_cookies(cookies)
                        req_cookies = tmp_cookie_jar.filter_cookies(url)
                        if req_cookies:
                            all_cookies.load(req_cookies)
    
                    if proxy is not None:
                        proxy = URL(proxy)
                    elif self._trust_env:
                        with suppress(LookupError):
                            proxy, proxy_auth = get_env_proxy_for_url(url)
    
                    req = self._request_class(
                        method,
                        url,
                        params=params,
                        headers=headers,
                        skip_auto_headers=skip_headers,
                        data=data,
                        cookies=all_cookies,
                        auth=auth,
                        version=version,
                        compress=compress,
                        chunked=chunked,
                        expect100=expect100,
                        loop=self._loop,
                        response_class=self._response_class,
                        proxy=proxy,
                        proxy_auth=proxy_auth,
                        timer=timer,
                        session=self,
                        ssl=ssl,
                        proxy_headers=proxy_headers,
                        traces=traces,
                    )
    
                    # connection timeout
                    try:
                        async with ceil_timeout(real_timeout.connect):
                            assert self._connector is not None
                            conn = await self._connector.connect(
                                req, traces=traces, timeout=real_timeout
                            )
                    except asyncio.TimeoutError as exc:
                        raise ServerTimeoutError(
                            "Connection timeout " "to host {}".format(url)
                        ) from exc
    
                    assert conn.transport is not None
    
                    assert conn.protocol is not None
                    conn.protocol.set_response_params(
                        timer=timer,
                        skip_payload=method.upper() == "HEAD",
                        read_until_eof=read_until_eof,
                        auto_decompress=self._auto_decompress,
                        read_timeout=real_timeout.sock_read,
                        read_bufsize=read_bufsize,
                    )
    
                    try:
                        try:
                            resp = await req.send(conn)
                            try:
>                               await resp.start(conn)

all_cookies = <SimpleCookie: >
allow_redirects = True
auth       = None
auth_from_url = None
chunked    = None
compress   = None
conn       = Connection<ConnectionKey(host='127.0.0.1', port=46329, is_ssl=False, ssl=None, proxy=None, proxy_auth=None, proxy_headers_hash=None)>
cookies    = None
data       = None
expect100  = False
fingerprint = None
handle     = None
headers    = <CIMultiDict()>
history    = []
json       = None
max_redirects = 10
method     = 'GET'
params     = None
proxy      = None
proxy_auth = None
proxy_headers = <CIMultiDict()>
raise_for_status = None
read_bufsize = 65536
read_until_eof = True
real_timeout = ClientTimeout(total=0.01, connect=None, sock_read=None, sock_connect=None)
redirects  = 0
req        = <aiohttp.client_reqrep.ClientRequest object at 0x7f1fc8160190>
resp       = <ClientResponse(http://127.0.0.1:46329/) [None None]>
None

self       = <aiohttp.client.ClientSession object at 0x7f1fc7ec4d50>
skip_auto_headers = None
skip_headers = set()
ssl        = None
ssl_context = None
str_or_url = URL('http://127.0.0.1:46329/')
timeout    = 0.01
timer      = <aiohttp.helpers.TimerContext object at 0x7f1fc81607d0>
tm         = <aiohttp.helpers.TimeoutHandle object at 0x7f1fc81ff710>
trace_request_ctx = None
traces     = []
url        = URL('http://127.0.0.1:46329/')
verify_ssl = None
version    = HttpVersion(major=1, minor=1)

../../BUILDROOT/python-aiohttp-3.8.1-4.fc37.x86_64/usr/lib64/python3.11/site-packages/aiohttp/client.py:559: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <ClientResponse(http://127.0.0.1:46329/) [None None]>
None

connection = Connection<ConnectionKey(host='127.0.0.1', port=46329, is_ssl=False, ssl=None, proxy=None, proxy_auth=None, proxy_headers_hash=None)>

    async def start(self, connection: "Connection") -> "ClientResponse":
        """Start response processing."""
        self._closed = False
        self._protocol = connection.protocol
        self._connection = connection
    
>       with self._timer:

connection = Connection<ConnectionKey(host='127.0.0.1', port=46329, is_ssl=False, ssl=None, proxy=None, proxy_auth=None, proxy_headers_hash=None)>
protocol   = <aiohttp.client_proto.ResponseHandler object at 0x7f1fc7c6bb60>
self       = <ClientResponse(http://127.0.0.1:46329/) [None None]>
None


../../BUILDROOT/python-aiohttp-3.8.1-4.fc37.x86_64/usr/lib64/python3.11/site-packages/aiohttp/client_reqrep.py:893: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <aiohttp.helpers.TimerContext object at 0x7f1fc81607d0>
exc_type = <class 'asyncio.exceptions.CancelledError'>
exc_val = CancelledError(), exc_tb = <traceback object at 0x7f1fc749b100>

    def __exit__(
        self,
        exc_type: Optional[Type[BaseException]],
        exc_val: Optional[BaseException],
        exc_tb: Optional[TracebackType],
    ) -> Optional[bool]:
        if self._tasks:
            self._tasks.pop()
    
        if exc_type is asyncio.CancelledError and self._cancelled:
>           raise asyncio.TimeoutError from None
E           TimeoutError

exc_tb     = <traceback object at 0x7f1fc749b100>
exc_type   = <class 'asyncio.exceptions.CancelledError'>
exc_val    = CancelledError()
self       = <aiohttp.helpers.TimerContext object at 0x7f1fc81607d0>

../../BUILDROOT/python-aiohttp-3.8.1-4.fc37.x86_64/usr/lib64/python3.11/site-packages/aiohttp/helpers.py:721: TimeoutError

The above exception was the direct cause of the following exception:

aiohttp_client = <function aiohttp_client.<locals>.go at 0x7f1fc7784d60>
mocker = <pytest_mock.plugin.MockerFixture object at 0x7f1fcace3450>

    async def test_timeout_on_reading_headers(aiohttp_client, mocker) -> None:
        async def handler(request):
            resp = web.StreamResponse()
            await asyncio.sleep(0.1)
            await resp.prepare(request)
            return resp
    
        app = web.Application()
        app.router.add_route("GET", "/", handler)
        client = await aiohttp_client(app)
    
        with pytest.raises(asyncio.TimeoutError):
>           await client.get("/", timeout=0.01)

aiohttp_client = <function aiohttp_client.<locals>.go at 0x7f1fc7784d60>
app        = <Application 0x7f1fc7ec4690>
client     = <aiohttp.test_utils.TestClient object at 0x7f1fc7ec67d0>
handler    = <function test_timeout_on_reading_headers.<locals>.handler at 0x7f1fc7784860>
mocker     = <pytest_mock.plugin.MockerFixture object at 0x7f1fcace3450>

tests/test_client_functional.py:587: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../BUILDROOT/python-aiohttp-3.8.1-4.fc37.x86_64/usr/lib64/python3.11/site-packages/aiohttp/test_utils.py:324: in _request
    resp = await self._session.request(method, self.make_url(path), **kwargs)
        kwargs     = {'timeout': 0.01}
        method     = 'GET'
        path       = '/'
        self       = <aiohttp.test_utils.TestClient object at 0x7f1fc7ec67d0>
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <aiohttp.client.ClientSession object at 0x7f1fc7ec4d50>, method = 'GET'
str_or_url = URL('http://127.0.0.1:46329/')

    async def _request(
        self,
        method: str,
        str_or_url: StrOrURL,
        *,
        params: Optional[Mapping[str, str]] = None,
        data: Any = None,
        json: Any = None,
        cookies: Optional[LooseCookies] = None,
        headers: Optional[LooseHeaders] = None,
        skip_auto_headers: Optional[Iterable[str]] = None,
        auth: Optional[BasicAuth] = None,
        allow_redirects: bool = True,
        max_redirects: int = 10,
        compress: Optional[str] = None,
        chunked: Optional[bool] = None,
        expect100: bool = False,
        raise_for_status: Optional[bool] = None,
        read_until_eof: bool = True,
        proxy: Optional[StrOrURL] = None,
        proxy_auth: Optional[BasicAuth] = None,
        timeout: Union[ClientTimeout, object] = sentinel,
        verify_ssl: Optional[bool] = None,
        fingerprint: Optional[bytes] = None,
        ssl_context: Optional[SSLContext] = None,
        ssl: Optional[Union[SSLContext, bool, Fingerprint]] = None,
        proxy_headers: Optional[LooseHeaders] = None,
        trace_request_ctx: Optional[SimpleNamespace] = None,
        read_bufsize: Optional[int] = None,
    ) -> ClientResponse:
    
        # NOTE: timeout clamps existing connect and read timeouts.  We cannot
        # set the default to None because we need to detect if the user wants
        # to use the existing timeouts by setting timeout to None.
    
        if self.closed:
            raise RuntimeError("Session is closed")
    
        ssl = _merge_ssl_params(ssl, verify_ssl, ssl_context, fingerprint)
    
        if data is not None and json is not None:
            raise ValueError(
                "data and json parameters can not be used at the same time"
            )
        elif json is not None:
            data = payload.JsonPayload(json, dumps=self._json_serialize)
    
        if not isinstance(chunked, bool) and chunked is not None:
            warnings.warn("Chunk size is deprecated #1615", DeprecationWarning)
    
        redirects = 0
        history = []
        version = self._version
    
        # Merge with default headers and transform to CIMultiDict
        headers = self._prepare_headers(headers)
        proxy_headers = self._prepare_headers(proxy_headers)
    
        try:
            url = self._build_url(str_or_url)
        except ValueError as e:
            raise InvalidURL(str_or_url) from e
    
        skip_headers = set(self._skip_auto_headers)
        if skip_auto_headers is not None:
            for i in skip_auto_headers:
                skip_headers.add(istr(i))
    
        if proxy is not None:
            try:
                proxy = URL(proxy)
            except ValueError as e:
                raise InvalidURL(proxy) from e
    
        if timeout is sentinel:
            real_timeout = self._timeout  # type: ClientTimeout
        else:
            if not isinstance(timeout, ClientTimeout):
                real_timeout = ClientTimeout(total=timeout)  # type: ignore[arg-type]
            else:
                real_timeout = timeout
        # timeout is cumulative for all request operations
        # (request, redirects, responses, data consuming)
        tm = TimeoutHandle(self._loop, real_timeout.total)
        handle = tm.start()
    
        if read_bufsize is None:
            read_bufsize = self._read_bufsize
    
        traces = [
            Trace(
                self,
                trace_config,
                trace_config.trace_config_ctx(trace_request_ctx=trace_request_ctx),
            )
            for trace_config in self._trace_configs
        ]
    
        for trace in traces:
            await trace.send_request_start(method, url.update_query(params), headers)
    
        timer = tm.timer()
        try:
            with timer:
                while True:
                    url, auth_from_url = strip_auth_from_url(url)
                    if auth and auth_from_url:
                        raise ValueError(
                            "Cannot combine AUTH argument with "
                            "credentials encoded in URL"
                        )
    
                    if auth is None:
                        auth = auth_from_url
                    if auth is None:
                        auth = self._default_auth
                    # It would be confusing if we support explicit
                    # Authorization header with auth argument
                    if (
                        headers is not None
                        and auth is not None
                        and hdrs.AUTHORIZATION in headers
                    ):
                        raise ValueError(
                            "Cannot combine AUTHORIZATION header "
                            "with AUTH argument or credentials "
                            "encoded in URL"
                        )
    
                    all_cookies = self._cookie_jar.filter_cookies(url)
    
                    if cookies is not None:
                        tmp_cookie_jar = CookieJar()
                        tmp_cookie_jar.update_cookies(cookies)
                        req_cookies = tmp_cookie_jar.filter_cookies(url)
                        if req_cookies:
                            all_cookies.load(req_cookies)
    
                    if proxy is not None:
                        proxy = URL(proxy)
                    elif self._trust_env:
                        with suppress(LookupError):
                            proxy, proxy_auth = get_env_proxy_for_url(url)
    
                    req = self._request_class(
                        method,
                        url,
                        params=params,
                        headers=headers,
                        skip_auto_headers=skip_headers,
                        data=data,
                        cookies=all_cookies,
                        auth=auth,
                        version=version,
                        compress=compress,
                        chunked=chunked,
                        expect100=expect100,
                        loop=self._loop,
                        response_class=self._response_class,
                        proxy=proxy,
                        proxy_auth=proxy_auth,
                        timer=timer,
                        session=self,
                        ssl=ssl,
                        proxy_headers=proxy_headers,
                        traces=traces,
                    )
    
                    # connection timeout
                    try:
                        async with ceil_timeout(real_timeout.connect):
                            assert self._connector is not None
                            conn = await self._connector.connect(
                                req, traces=traces, timeout=real_timeout
                            )
                    except asyncio.TimeoutError as exc:
                        raise ServerTimeoutError(
                            "Connection timeout " "to host {}".format(url)
                        ) from exc
    
                    assert conn.transport is not None
    
                    assert conn.protocol is not None
                    conn.protocol.set_response_params(
                        timer=timer,
                        skip_payload=method.upper() == "HEAD",
                        read_until_eof=read_until_eof,
                        auto_decompress=self._auto_decompress,
                        read_timeout=real_timeout.sock_read,
                        read_bufsize=read_bufsize,
                    )
    
                    try:
                        try:
                            resp = await req.send(conn)
                            try:
                                await resp.start(conn)
                            except BaseException:
                                resp.close()
                                raise
                        except BaseException:
                            conn.close()
                            raise
                    except ClientError:
                        raise
                    except OSError as exc:
>                       raise ClientOSError(*exc.args) from exc
E                       aiohttp.client_exceptions.ClientOSError

all_cookies = <SimpleCookie: >
allow_redirects = True
auth       = None
auth_from_url = None
chunked    = None
compress   = None
conn       = Connection<ConnectionKey(host='127.0.0.1', port=46329, is_ssl=False, ssl=None, proxy=None, proxy_auth=None, proxy_headers_hash=None)>
cookies    = None
data       = None
expect100  = False
fingerprint = None
handle     = None
headers    = <CIMultiDict()>
history    = []
json       = None
max_redirects = 10
method     = 'GET'
params     = None
proxy      = None
proxy_auth = None
proxy_headers = <CIMultiDict()>
raise_for_status = None
read_bufsize = 65536
read_until_eof = True
real_timeout = ClientTimeout(total=0.01, connect=None, sock_read=None, sock_connect=None)
redirects  = 0
req        = <aiohttp.client_reqrep.ClientRequest object at 0x7f1fc8160190>
resp       = <ClientResponse(http://127.0.0.1:46329/) [None None]>
None

self       = <aiohttp.client.ClientSession object at 0x7f1fc7ec4d50>
skip_auto_headers = None
skip_headers = set()
ssl        = None
ssl_context = None
str_or_url = URL('http://127.0.0.1:46329/')
timeout    = 0.01
timer      = <aiohttp.helpers.TimerContext object at 0x7f1fc81607d0>
tm         = <aiohttp.helpers.TimeoutHandle object at 0x7f1fc81ff710>
trace_request_ctx = None
traces     = []
url        = URL('http://127.0.0.1:46329/')
verify_ssl = None
version    = HttpVersion(major=1, minor=1)

../../BUILDROOT/python-aiohttp-3.8.1-4.fc37.x86_64/usr/lib64/python3.11/site-packages/aiohttp/client.py:569: ClientOSError
_________________ test_timeout_on_conn_reading_headers[pyloop] _________________

self = <aiohttp.client.ClientSession object at 0x7f1fc60c2e10>, method = 'GET'
str_or_url = URL('http://127.0.0.1:44895/')

    async def _request(
        self,
        method: str,
        str_or_url: StrOrURL,
        *,
        params: Optional[Mapping[str, str]] = None,
        data: Any = None,
        json: Any = None,
        cookies: Optional[LooseCookies] = None,
        headers: Optional[LooseHeaders] = None,
        skip_auto_headers: Optional[Iterable[str]] = None,
        auth: Optional[BasicAuth] = None,
        allow_redirects: bool = True,
        max_redirects: int = 10,
        compress: Optional[str] = None,
        chunked: Optional[bool] = None,
        expect100: bool = False,
        raise_for_status: Optional[bool] = None,
        read_until_eof: bool = True,
        proxy: Optional[StrOrURL] = None,
        proxy_auth: Optional[BasicAuth] = None,
        timeout: Union[ClientTimeout, object] = sentinel,
        verify_ssl: Optional[bool] = None,
        fingerprint: Optional[bytes] = None,
        ssl_context: Optional[SSLContext] = None,
        ssl: Optional[Union[SSLContext, bool, Fingerprint]] = None,
        proxy_headers: Optional[LooseHeaders] = None,
        trace_request_ctx: Optional[SimpleNamespace] = None,
        read_bufsize: Optional[int] = None,
    ) -> ClientResponse:
    
        # NOTE: timeout clamps existing connect and read timeouts.  We cannot
        # set the default to None because we need to detect if the user wants
        # to use the existing timeouts by setting timeout to None.
    
        if self.closed:
            raise RuntimeError("Session is closed")
    
        ssl = _merge_ssl_params(ssl, verify_ssl, ssl_context, fingerprint)
    
        if data is not None and json is not None:
            raise ValueError(
                "data and json parameters can not be used at the same time"
            )
        elif json is not None:
            data = payload.JsonPayload(json, dumps=self._json_serialize)
    
        if not isinstance(chunked, bool) and chunked is not None:
            warnings.warn("Chunk size is deprecated #1615", DeprecationWarning)
    
        redirects = 0
        history = []
        version = self._version
    
        # Merge with default headers and transform to CIMultiDict
        headers = self._prepare_headers(headers)
        proxy_headers = self._prepare_headers(proxy_headers)
    
        try:
            url = self._build_url(str_or_url)
        except ValueError as e:
            raise InvalidURL(str_or_url) from e
    
        skip_headers = set(self._skip_auto_headers)
        if skip_auto_headers is not None:
            for i in skip_auto_headers:
                skip_headers.add(istr(i))
    
        if proxy is not None:
            try:
                proxy = URL(proxy)
            except ValueError as e:
                raise InvalidURL(proxy) from e
    
        if timeout is sentinel:
            real_timeout = self._timeout  # type: ClientTimeout
        else:
            if not isinstance(timeout, ClientTimeout):
                real_timeout = ClientTimeout(total=timeout)  # type: ignore[arg-type]
            else:
                real_timeout = timeout
        # timeout is cumulative for all request operations
        # (request, redirects, responses, data consuming)
        tm = TimeoutHandle(self._loop, real_timeout.total)
        handle = tm.start()
    
        if read_bufsize is None:
            read_bufsize = self._read_bufsize
    
        traces = [
            Trace(
                self,
                trace_config,
                trace_config.trace_config_ctx(trace_request_ctx=trace_request_ctx),
            )
            for trace_config in self._trace_configs
        ]
    
        for trace in traces:
            await trace.send_request_start(method, url.update_query(params), headers)
    
        timer = tm.timer()
        try:
            with timer:
                while True:
                    url, auth_from_url = strip_auth_from_url(url)
                    if auth and auth_from_url:
                        raise ValueError(
                            "Cannot combine AUTH argument with "
                            "credentials encoded in URL"
                        )
    
                    if auth is None:
                        auth = auth_from_url
                    if auth is None:
                        auth = self._default_auth
                    # It would be confusing if we support explicit
                    # Authorization header with auth argument
                    if (
                        headers is not None
                        and auth is not None
                        and hdrs.AUTHORIZATION in headers
                    ):
                        raise ValueError(
                            "Cannot combine AUTHORIZATION header "
                            "with AUTH argument or credentials "
                            "encoded in URL"
                        )
    
                    all_cookies = self._cookie_jar.filter_cookies(url)
    
                    if cookies is not None:
                        tmp_cookie_jar = CookieJar()
                        tmp_cookie_jar.update_cookies(cookies)
                        req_cookies = tmp_cookie_jar.filter_cookies(url)
                        if req_cookies:
                            all_cookies.load(req_cookies)
    
                    if proxy is not None:
                        proxy = URL(proxy)
                    elif self._trust_env:
                        with suppress(LookupError):
                            proxy, proxy_auth = get_env_proxy_for_url(url)
    
                    req = self._request_class(
                        method,
                        url,
                        params=params,
                        headers=headers,
                        skip_auto_headers=skip_headers,
                        data=data,
                        cookies=all_cookies,
                        auth=auth,
                        version=version,
                        compress=compress,
                        chunked=chunked,
                        expect100=expect100,
                        loop=self._loop,
                        response_class=self._response_class,
                        proxy=proxy,
                        proxy_auth=proxy_auth,
                        timer=timer,
                        session=self,
                        ssl=ssl,
                        proxy_headers=proxy_headers,
                        traces=traces,
                    )
    
                    # connection timeout
                    try:
                        async with ceil_timeout(real_timeout.connect):
                            assert self._connector is not None
                            conn = await self._connector.connect(
                                req, traces=traces, timeout=real_timeout
                            )
                    except asyncio.TimeoutError as exc:
                        raise ServerTimeoutError(
                            "Connection timeout " "to host {}".format(url)
                        ) from exc
    
                    assert conn.transport is not None
    
                    assert conn.protocol is not None
                    conn.protocol.set_response_params(
                        timer=timer,
                        skip_payload=method.upper() == "HEAD",
                        read_until_eof=read_until_eof,
                        auto_decompress=self._auto_decompress,
                        read_timeout=real_timeout.sock_read,
                        read_bufsize=read_bufsize,
                    )
    
                    try:
                        try:
                            resp = await req.send(conn)
                            try:
>                               await resp.start(conn)

all_cookies = <SimpleCookie: >
allow_redirects = True
auth       = None
auth_from_url = None
chunked    = None
compress   = None
conn       = Connection<ConnectionKey(host='127.0.0.1', port=44895, is_ssl=False, ssl=None, proxy=None, proxy_auth=None, proxy_headers_hash=None)>
cookies    = None
data       = None
expect100  = False
fingerprint = None
handle     = None
headers    = <CIMultiDict()>
history    = []
json       = None
max_redirects = 10
method     = 'GET'
params     = None
proxy      = None
proxy_auth = None
proxy_headers = <CIMultiDict()>
raise_for_status = None
read_bufsize = 65536
read_until_eof = True
real_timeout = ClientTimeout(total=0.01, connect=None, sock_read=None, sock_connect=None)
redirects  = 0
req        = <aiohttp.client_reqrep.ClientRequest object at 0x7f1fc60c3110>
resp       = <ClientResponse(http://127.0.0.1:44895/) [None None]>
None

self       = <aiohttp.client.ClientSession object at 0x7f1fc60c2e10>
skip_auto_headers = None
skip_headers = set()
ssl        = None
ssl_context = None
str_or_url = URL('http://127.0.0.1:44895/')
timeout    = 0.01
timer      = <aiohttp.helpers.TimerContext object at 0x7f1fc60c37d0>
tm         = <aiohttp.helpers.TimeoutHandle object at 0x7f1fc60c3410>
trace_request_ctx = None
traces     = []
url        = URL('http://127.0.0.1:44895/')
verify_ssl = None
version    = HttpVersion(major=1, minor=1)

../../BUILDROOT/python-aiohttp-3.8.1-4.fc37.x86_64/usr/lib64/python3.11/site-packages/aiohttp/client.py:559: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <ClientResponse(http://127.0.0.1:44895/) [None None]>
None

connection = Connection<ConnectionKey(host='127.0.0.1', port=44895, is_ssl=False, ssl=None, proxy=None, proxy_auth=None, proxy_headers_hash=None)>

    async def start(self, connection: "Connection") -> "ClientResponse":
        """Start response processing."""
        self._closed = False
        self._protocol = connection.protocol
        self._connection = connection
    
>       with self._timer:

connection = Connection<ConnectionKey(host='127.0.0.1', port=44895, is_ssl=False, ssl=None, proxy=None, proxy_auth=None, proxy_headers_hash=None)>
protocol   = <aiohttp.client_proto.ResponseHandler object at 0x7f1fc6078980>
self       = <ClientResponse(http://127.0.0.1:44895/) [None None]>
None


../../BUILDROOT/python-aiohttp-3.8.1-4.fc37.x86_64/usr/lib64/python3.11/site-packages/aiohttp/client_reqrep.py:893: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <aiohttp.helpers.TimerContext object at 0x7f1fc60c37d0>
exc_type = <class 'asyncio.exceptions.CancelledError'>
exc_val = CancelledError(), exc_tb = <traceback object at 0x7f1fc5fb9c40>

    def __exit__(
        self,
        exc_type: Optional[Type[BaseException]],
        exc_val: Optional[BaseException],
        exc_tb: Optional[TracebackType],
    ) -> Optional[bool]:
        if self._tasks:
            self._tasks.pop()
    
        if exc_type is asyncio.CancelledError and self._cancelled:
>           raise asyncio.TimeoutError from None
E           TimeoutError

exc_tb     = <traceback object at 0x7f1fc5fb9c40>
exc_type   = <class 'asyncio.exceptions.CancelledError'>
exc_val    = CancelledError()
self       = <aiohttp.helpers.TimerContext object at 0x7f1fc60c37d0>

../../BUILDROOT/python-aiohttp-3.8.1-4.fc37.x86_64/usr/lib64/python3.11/site-packages/aiohttp/helpers.py:721: TimeoutError

The above exception was the direct cause of the following exception:

aiohttp_client = <function aiohttp_client.<locals>.go at 0x7f1fc7786160>
mocker = <pytest_mock.plugin.MockerFixture object at 0x7f1fc60c1d50>

    async def test_timeout_on_conn_reading_headers(aiohttp_client, mocker) -> None:
        # tests case where user did not set a connection timeout
    
        async def handler(request):
            resp = web.StreamResponse()
            await asyncio.sleep(0.1)
            await resp.prepare(request)
            return resp
    
        app = web.Application()
        app.router.add_route("GET", "/", handler)
    
        conn = aiohttp.TCPConnector()
        client = await aiohttp_client(app, connector=conn)
    
        with pytest.raises(asyncio.TimeoutError):
>           await client.get("/", timeout=0.01)

aiohttp_client = <function aiohttp_client.<locals>.go at 0x7f1fc7786160>
app        = <Application 0x7f1fc60c2350>
client     = <aiohttp.test_utils.TestClient object at 0x7f1fc60c2d10>
conn       = <aiohttp.connector.TCPConnector object at 0x7f1fc60c2950>
handler    = <function test_timeout_on_conn_reading_headers.<locals>.handler at 0x7f1fc7785800>
mocker     = <pytest_mock.plugin.MockerFixture object at 0x7f1fc60c1d50>

tests/test_client_functional.py:606: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../BUILDROOT/python-aiohttp-3.8.1-4.fc37.x86_64/usr/lib64/python3.11/site-packages/aiohttp/test_utils.py:324: in _request
    resp = await self._session.request(method, self.make_url(path), **kwargs)
        kwargs     = {'timeout': 0.01}
        method     = 'GET'
        path       = '/'
        self       = <aiohttp.test_utils.TestClient object at 0x7f1fc60c2d10>
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <aiohttp.client.ClientSession object at 0x7f1fc60c2e10>, method = 'GET'
str_or_url = URL('http://127.0.0.1:44895/')

    async def _request(
        self,
        method: str,
        str_or_url: StrOrURL,
        *,
        params: Optional[Mapping[str, str]] = None,
        data: Any = None,
        json: Any = None,
        cookies: Optional[LooseCookies] = None,
        headers: Optional[LooseHeaders] = None,
        skip_auto_headers: Optional[Iterable[str]] = None,
        auth: Optional[BasicAuth] = None,
        allow_redirects: bool = True,
        max_redirects: int = 10,
        compress: Optional[str] = None,
        chunked: Optional[bool] = None,
        expect100: bool = False,
        raise_for_status: Optional[bool] = None,
        read_until_eof: bool = True,
        proxy: Optional[StrOrURL] = None,
        proxy_auth: Optional[BasicAuth] = None,
        timeout: Union[ClientTimeout, object] = sentinel,
        verify_ssl: Optional[bool] = None,
        fingerprint: Optional[bytes] = None,
        ssl_context: Optional[SSLContext] = None,
        ssl: Optional[Union[SSLContext, bool, Fingerprint]] = None,
        proxy_headers: Optional[LooseHeaders] = None,
        trace_request_ctx: Optional[SimpleNamespace] = None,
        read_bufsize: Optional[int] = None,
    ) -> ClientResponse:
    
        # NOTE: timeout clamps existing connect and read timeouts.  We cannot
        # set the default to None because we need to detect if the user wants
        # to use the existing timeouts by setting timeout to None.
    
        if self.closed:
            raise RuntimeError("Session is closed")
    
        ssl = _merge_ssl_params(ssl, verify_ssl, ssl_context, fingerprint)
    
        if data is not None and json is not None:
            raise ValueError(
                "data and json parameters can not be used at the same time"
            )
        elif json is not None:
            data = payload.JsonPayload(json, dumps=self._json_serialize)
    
        if not isinstance(chunked, bool) and chunked is not None:
            warnings.warn("Chunk size is deprecated #1615", DeprecationWarning)
    
        redirects = 0
        history = []
        version = self._version
    
        # Merge with default headers and transform to CIMultiDict
        headers = self._prepare_headers(headers)
        proxy_headers = self._prepare_headers(proxy_headers)
    
        try:
            url = self._build_url(str_or_url)
        except ValueError as e:
            raise InvalidURL(str_or_url) from e
    
        skip_headers = set(self._skip_auto_headers)
        if skip_auto_headers is not None:
            for i in skip_auto_headers:
                skip_headers.add(istr(i))
    
        if proxy is not None:
            try:
                proxy = URL(proxy)
            except ValueError as e:
                raise InvalidURL(proxy) from e
    
        if timeout is sentinel:
            real_timeout = self._timeout  # type: ClientTimeout
        else:
            if not isinstance(timeout, ClientTimeout):
                real_timeout = ClientTimeout(total=timeout)  # type: ignore[arg-type]
            else:
                real_timeout = timeout
        # timeout is cumulative for all request operations
        # (request, redirects, responses, data consuming)
        tm = TimeoutHandle(self._loop, real_timeout.total)
        handle = tm.start()
    
        if read_bufsize is None:
            read_bufsize = self._read_bufsize
    
        traces = [
            Trace(
                self,
                trace_config,
                trace_config.trace_config_ctx(trace_request_ctx=trace_request_ctx),
            )
            for trace_config in self._trace_configs
        ]
    
        for trace in traces:
            await trace.send_request_start(method, url.update_query(params), headers)
    
        timer = tm.timer()
        try:
            with timer:
                while True:
                    url, auth_from_url = strip_auth_from_url(url)
                    if auth and auth_from_url:
                        raise ValueError(
                            "Cannot combine AUTH argument with "
                            "credentials encoded in URL"
                        )
    
                    if auth is None:
                        auth = auth_from_url
                    if auth is None:
                        auth = self._default_auth
                    # It would be confusing if we support explicit
                    # Authorization header with auth argument
                    if (
                        headers is not None
                        and auth is not None
                        and hdrs.AUTHORIZATION in headers
                    ):
                        raise ValueError(
                            "Cannot combine AUTHORIZATION header "
                            "with AUTH argument or credentials "
                            "encoded in URL"
                        )
    
                    all_cookies = self._cookie_jar.filter_cookies(url)
    
                    if cookies is not None:
                        tmp_cookie_jar = CookieJar()
                        tmp_cookie_jar.update_cookies(cookies)
                        req_cookies = tmp_cookie_jar.filter_cookies(url)
                        if req_cookies:
                            all_cookies.load(req_cookies)
    
                    if proxy is not None:
                        proxy = URL(proxy)
                    elif self._trust_env:
                        with suppress(LookupError):
                            proxy, proxy_auth = get_env_proxy_for_url(url)
    
                    req = self._request_class(
                        method,
                        url,
                        params=params,
                        headers=headers,
                        skip_auto_headers=skip_headers,
                        data=data,
                        cookies=all_cookies,
                        auth=auth,
                        version=version,
                        compress=compress,
                        chunked=chunked,
                        expect100=expect100,
                        loop=self._loop,
                        response_class=self._response_class,
                        proxy=proxy,
                        proxy_auth=proxy_auth,
                        timer=timer,
                        session=self,
                        ssl=ssl,
                        proxy_headers=proxy_headers,
                        traces=traces,
                    )
    
                    # connection timeout
                    try:
                        async with ceil_timeout(real_timeout.connect):
                            assert self._connector is not None
                            conn = await self._connector.connect(
                                req, traces=traces, timeout=real_timeout
                            )
                    except asyncio.TimeoutError as exc:
                        raise ServerTimeoutError(
                            "Connection timeout " "to host {}".format(url)
                        ) from exc
    
                    assert conn.transport is not None
    
                    assert conn.protocol is not None
                    conn.protocol.set_response_params(
                        timer=timer,
                        skip_payload=method.upper() == "HEAD",
                        read_until_eof=read_until_eof,
                        auto_decompress=self._auto_decompress,
                        read_timeout=real_timeout.sock_read,
                        read_bufsize=read_bufsize,
                    )
    
                    try:
                        try:
                            resp = await req.send(conn)
                            try:
                                await resp.start(conn)
                            except BaseException:
                                resp.close()
                                raise
                        except BaseException:
                            conn.close()
                            raise
                    except ClientError:
                        raise
                    except OSError as exc:
>                       raise ClientOSError(*exc.args) from exc
E                       aiohttp.client_exceptions.ClientOSError

all_cookies = <SimpleCookie: >
allow_redirects = True
auth       = None
auth_from_url = None
chunked    = None
compress   = None
conn       = Connection<ConnectionKey(host='127.0.0.1', port=44895, is_ssl=False, ssl=None, proxy=None, proxy_auth=None, proxy_headers_hash=None)>
cookies    = None
data       = None
expect100  = False
fingerprint = None
handle     = None
headers    = <CIMultiDict()>
history    = []
json       = None
max_redirects = 10
method     = 'GET'
params     = None
proxy      = None
proxy_auth = None
proxy_headers = <CIMultiDict()>
raise_for_status = None
read_bufsize = 65536
read_until_eof = True
real_timeout = ClientTimeout(total=0.01, connect=None, sock_read=None, sock_connect=None)
redirects  = 0
req        = <aiohttp.client_reqrep.ClientRequest object at 0x7f1fc60c3110>
resp       = <ClientResponse(http://127.0.0.1:44895/) [None None]>
None

self       = <aiohttp.client.ClientSession object at 0x7f1fc60c2e10>
skip_auto_headers = None
skip_headers = set()
ssl        = None
ssl_context = None
str_or_url = URL('http://127.0.0.1:44895/')
timeout    = 0.01
timer      = <aiohttp.helpers.TimerContext object at 0x7f1fc60c37d0>
tm         = <aiohttp.helpers.TimeoutHandle object at 0x7f1fc60c3410>
trace_request_ctx = None
traces     = []
url        = URL('http://127.0.0.1:44895/')
verify_ssl = None
version    = HttpVersion(major=1, minor=1)

../../BUILDROOT/python-aiohttp-3.8.1-4.fc37.x86_64/usr/lib64/python3.11/site-packages/aiohttp/client.py:569: ClientOSError
______________________ test_data_stream_exc_chain[pyloop] ______________________

loop = <_UnixSelectorEventLoop running=False closed=False debug=False>
conn = <Mock id='139774466103184'>

    async def test_data_stream_exc_chain(loop, conn) -> None:
        fut = loop.create_future()
    
        @async_generator
        async def gen():
            await fut
    
        req = ClientRequest("POST", URL("http://python.org/"), data=gen(), loop=loop)
    
        inner_exc = ValueError()
    
        async def throw_exc():
            await asyncio.sleep(0.01)
            fut.set_exception(inner_exc)
    
        loop.create_task(throw_exc())
    
        await req.send(conn)
        await req._writer
        # assert connection.close.called
        assert conn.protocol.set_exception.called
        outer_exc = conn.protocol.set_exception.call_args[0][0]
>       assert isinstance(outer_exc, ValueError)
E       AssertionError: assert False
E        +  where False = isinstance(TypeError('throw() third argument must be a traceback'), ValueError)

conn       = <Mock id='139774466103184'>
fut        = <Future finished exception=ValueError()>
gen        = <function test_data_stream_exc_chain.<locals>.gen at 0x7f1fc809ce00>
inner_exc  = ValueError()
loop       = <_UnixSelectorEventLoop running=False closed=False debug=False>
outer_exc  = TypeError('throw() third argument must be a traceback')
req        = <aiohttp.client_reqrep.ClientRequest object at 0x7f1fc766aad0>
throw_exc  = <function test_data_stream_exc_chain.<locals>.throw_exc at 0x7f1fc809cfe0>

tests/test_client_request.py:1052: AssertionError
__________________________ TestCase.test_default_loop __________________________

self = <test_loop.TestCase testMethod=test_default_loop>

    def setUp(self) -> None:
        try:
>           self.loop = asyncio.get_running_loop()
E           RuntimeError: no running event loop

self       = <test_loop.TestCase testMethod=test_default_loop>

../../BUILDROOT/python-aiohttp-3.8.1-4.fc37.x86_64/usr/lib64/python3.11/site-packages/aiohttp/test_utils.py:459: RuntimeError

During handling of the above exception, another exception occurred:
/usr/lib64/python3.11/unittest/async_case.py:62: in _callSetUp
    self._asyncioTestContext.run(self.setUp)
        self       = <test_loop.TestCase testMethod=test_default_loop>
../../BUILDROOT/python-aiohttp-3.8.1-4.fc37.x86_64/usr/lib64/python3.11/site-packages/aiohttp/test_utils.py:461: in setUp
    self.loop = asyncio.get_event_loop_policy().get_event_loop()
        self       = <test_loop.TestCase testMethod=test_default_loop>
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <asyncio.unix_events._UnixDefaultEventLoopPolicy object at 0x7f1fc60915d0>

    def get_event_loop(self):
        """Get the event loop for the current context.
    
        Returns an instance of EventLoop or raises an exception.
        """
        if (self._local._loop is None and
                not self._local._set_called and
                threading.current_thread() is threading.main_thread()):
            self.set_event_loop(self.new_event_loop())
    
        if self._local._loop is None:
>           raise RuntimeError('There is no current event loop in thread %r.'
                               % threading.current_thread().name)
E           RuntimeError: There is no current event loop in thread 'MainThread'.

self       = <asyncio.unix_events._UnixDefaultEventLoopPolicy object at 0x7f1fc60915d0>

/usr/lib64/python3.11/asyncio/events.py:677: RuntimeError
________________________ TestCase.test_on_startup_hook _________________________

self = <test_loop.TestCase testMethod=test_on_startup_hook>

    def setUp(self) -> None:
        try:
>           self.loop = asyncio.get_running_loop()
E           RuntimeError: no running event loop

self       = <test_loop.TestCase testMethod=test_on_startup_hook>

../../BUILDROOT/python-aiohttp-3.8.1-4.fc37.x86_64/usr/lib64/python3.11/site-packages/aiohttp/test_utils.py:459: RuntimeError

During handling of the above exception, another exception occurred:
/usr/lib64/python3.11/unittest/async_case.py:62: in _callSetUp
    self._asyncioTestContext.run(self.setUp)
        self       = <test_loop.TestCase testMethod=test_on_startup_hook>
../../BUILDROOT/python-aiohttp-3.8.1-4.fc37.x86_64/usr/lib64/python3.11/site-packages/aiohttp/test_utils.py:461: in setUp
    self.loop = asyncio.get_event_loop_policy().get_event_loop()
        self       = <test_loop.TestCase testMethod=test_on_startup_hook>
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <asyncio.unix_events._UnixDefaultEventLoopPolicy object at 0x7f1fc60915d0>

    def get_event_loop(self):
        """Get the event loop for the current context.
    
        Returns an instance of EventLoop or raises an exception.
        """
        if (self._local._loop is None and
                not self._local._set_called and
                threading.current_thread() is threading.main_thread()):
            self.set_event_loop(self.new_event_loop())
    
        if self._local._loop is None:
>           raise RuntimeError('There is no current event loop in thread %r.'
                               % threading.current_thread().name)
E           RuntimeError: There is no current event loop in thread 'MainThread'.

self       = <asyncio.unix_events._UnixDefaultEventLoopPolicy object at 0x7f1fc60915d0>

/usr/lib64/python3.11/asyncio/events.py:677: RuntimeError
__________________ TestAioHTTPTestCase.test_example_with_loop __________________

self = <test_test_utils.TestAioHTTPTestCase testMethod=test_example_with_loop>

    def setUp(self) -> None:
        try:
>           self.loop = asyncio.get_running_loop()
E           RuntimeError: no running event loop

self       = <test_test_utils.TestAioHTTPTestCase testMethod=test_example_with_loop>

../../BUILDROOT/python-aiohttp-3.8.1-4.fc37.x86_64/usr/lib64/python3.11/site-packages/aiohttp/test_utils.py:459: RuntimeError

During handling of the above exception, another exception occurred:
/usr/lib64/python3.11/unittest/async_case.py:62: in _callSetUp
    self._asyncioTestContext.run(self.setUp)
        self       = <test_test_utils.TestAioHTTPTestCase testMethod=test_example_with_loop>
../../BUILDROOT/python-aiohttp-3.8.1-4.fc37.x86_64/usr/lib64/python3.11/site-packages/aiohttp/test_utils.py:461: in setUp
    self.loop = asyncio.get_event_loop_policy().get_event_loop()
        self       = <test_test_utils.TestAioHTTPTestCase testMethod=test_example_with_loop>
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <asyncio.unix_events._UnixDefaultEventLoopPolicy object at 0x7f1fc60d0990>

    def get_event_loop(self):
        """Get the event loop for the current context.
    
        Returns an instance of EventLoop or raises an exception.
        """
        if (self._local._loop is None and
                not self._local._set_called and
                threading.current_thread() is threading.main_thread()):
            self.set_event_loop(self.new_event_loop())
    
        if self._local._loop is None:
>           raise RuntimeError('There is no current event loop in thread %r.'
                               % threading.current_thread().name)
E           RuntimeError: There is no current event loop in thread 'MainThread'.

self       = <asyncio.unix_events._UnixDefaultEventLoopPolicy object at 0x7f1fc60d0990>

/usr/lib64/python3.11/asyncio/events.py:677: RuntimeError
____________ TestAioHTTPTestCase.test_example_without_explicit_loop ____________

self = <test_test_utils.TestAioHTTPTestCase testMethod=test_example_without_explicit_loop>

    def setUp(self) -> None:
        try:
>           self.loop = asyncio.get_running_loop()
E           RuntimeError: no running event loop

self       = <test_test_utils.TestAioHTTPTestCase testMethod=test_example_without_explicit_loop>

../../BUILDROOT/python-aiohttp-3.8.1-4.fc37.x86_64/usr/lib64/python3.11/site-packages/aiohttp/test_utils.py:459: RuntimeError

During handling of the above exception, another exception occurred:
/usr/lib64/python3.11/unittest/async_case.py:62: in _callSetUp
    self._asyncioTestContext.run(self.setUp)
        self       = <test_test_utils.TestAioHTTPTestCase testMethod=test_example_without_explicit_loop>
../../BUILDROOT/python-aiohttp-3.8.1-4.fc37.x86_64/usr/lib64/python3.11/site-packages/aiohttp/test_utils.py:461: in setUp
    self.loop = asyncio.get_event_loop_policy().get_event_loop()
        self       = <test_test_utils.TestAioHTTPTestCase testMethod=test_example_without_explicit_loop>
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <asyncio.unix_events._UnixDefaultEventLoopPolicy object at 0x7f1fc60d0990>

    def get_event_loop(self):
        """Get the event loop for the current context.
    
        Returns an instance of EventLoop or raises an exception.
        """
        if (self._local._loop is None and
                not self._local._set_called and
                threading.current_thread() is threading.main_thread()):
            self.set_event_loop(self.new_event_loop())
    
        if self._local._loop is None:
>           raise RuntimeError('There is no current event loop in thread %r.'
                               % threading.current_thread().name)
E           RuntimeError: There is no current event loop in thread 'MainThread'.

self       = <asyncio.unix_events._UnixDefaultEventLoopPolicy object at 0x7f1fc60d0990>

/usr/lib64/python3.11/asyncio/events.py:677: RuntimeError
____________________ TestAioHTTPTestCase.test_inner_example ____________________

self = <test_test_utils.TestAioHTTPTestCase testMethod=test_inner_example>

    def setUp(self) -> None:
        try:
>           self.loop = asyncio.get_running_loop()
E           RuntimeError: no running event loop

self       = <test_test_utils.TestAioHTTPTestCase testMethod=test_inner_example>

../../BUILDROOT/python-aiohttp-3.8.1-4.fc37.x86_64/usr/lib64/python3.11/site-packages/aiohttp/test_utils.py:459: RuntimeError

During handling of the above exception, another exception occurred:
/usr/lib64/python3.11/unittest/async_case.py:62: in _callSetUp
    self._asyncioTestContext.run(self.setUp)
        self       = <test_test_utils.TestAioHTTPTestCase testMethod=test_inner_example>
../../BUILDROOT/python-aiohttp-3.8.1-4.fc37.x86_64/usr/lib64/python3.11/site-packages/aiohttp/test_utils.py:461: in setUp
    self.loop = asyncio.get_event_loop_policy().get_event_loop()
        self       = <test_test_utils.TestAioHTTPTestCase testMethod=test_inner_example>
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <asyncio.unix_events._UnixDefaultEventLoopPolicy object at 0x7f1fc60d0990>

    def get_event_loop(self):
        """Get the event loop for the current context.
    
        Returns an instance of EventLoop or raises an exception.
        """
        if (self._local._loop is None and
                not self._local._set_called and
                threading.current_thread() is threading.main_thread()):
            self.set_event_loop(self.new_event_loop())
    
        if self._local._loop is None:
>           raise RuntimeError('There is no current event loop in thread %r.'
                               % threading.current_thread().name)
E           RuntimeError: There is no current event loop in thread 'MainThread'.

self       = <asyncio.unix_events._UnixDefaultEventLoopPolicy object at 0x7f1fc60d0990>

/usr/lib64/python3.11/asyncio/events.py:677: RuntimeError
_________ TestAioHTTPTestCase.test_inner_example_without_explicit_loop _________

self = <test_test_utils.TestAioHTTPTestCase testMethod=test_inner_example_without_explicit_loop>

    def setUp(self) -> None:
        try:
>           self.loop = asyncio.get_running_loop()
E           RuntimeError: no running event loop

self       = <test_test_utils.TestAioHTTPTestCase testMethod=test_inner_example_without_explicit_loop>

../../BUILDROOT/python-aiohttp-3.8.1-4.fc37.x86_64/usr/lib64/python3.11/site-packages/aiohttp/test_utils.py:459: RuntimeError

During handling of the above exception, another exception occurred:
/usr/lib64/python3.11/unittest/async_case.py:62: in _callSetUp
    self._asyncioTestContext.run(self.setUp)
        self       = <test_test_utils.TestAioHTTPTestCase testMethod=test_inner_example_without_explicit_loop>
../../BUILDROOT/python-aiohttp-3.8.1-4.fc37.x86_64/usr/lib64/python3.11/site-packages/aiohttp/test_utils.py:461: in setUp
    self.loop = asyncio.get_event_loop_policy().get_event_loop()
        self       = <test_test_utils.TestAioHTTPTestCase testMethod=test_inner_example_without_explicit_loop>
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <asyncio.unix_events._UnixDefaultEventLoopPolicy object at 0x7f1fc60d0990>

    def get_event_loop(self):
        """Get the event loop for the current context.
    
        Returns an instance of EventLoop or raises an exception.
        """
        if (self._local._loop is None and
                not self._local._set_called and
                threading.current_thread() is threading.main_thread()):
            self.set_event_loop(self.new_event_loop())
    
        if self._local._loop is None:
>           raise RuntimeError('There is no current event loop in thread %r.'
                               % threading.current_thread().name)
E           RuntimeError: There is no current event loop in thread 'MainThread'.

self       = <asyncio.unix_events._UnixDefaultEventLoopPolicy object at 0x7f1fc60d0990>

/usr/lib64/python3.11/asyncio/events.py:677: RuntimeError

Comment 2 Miro Hrončok 2022-06-08 15:16:29 UTC
Workaround in https://src.fedoraproject.org/rpms/python-aiohttp/pull-request/7

Comment 3 Miro Hrončok 2022-06-22 11:49:14 UTC
Closing this in bulk as it built with Python 3.11. If this needs to remain open for a followup, feel free to reopen, I won't close in bulk again.


Note You need to log in before you can comment on or make changes to this bug.