Skip to content

TypeError: 'Timeout' object does not support the context manager protocol #4

@yauhen-sobaleu

Description

@yauhen-sobaleu

Hello!

You can get this error when using fresh Python versions above 3.11

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <aiosocketpool.AsyncTcpConnector object at 0x10cce5350>

    async def connect(self) -> bool:
        """Establish a connection to the remote host.
    
        Returns
        -------
        `True` if the connection was successfully established, raises if not.
        """
        if __debug__:
            logging.debug(f"AsyncTcpConnector: new connection to {self.host}:{self.port}")
    
        loop = asyncio.get_event_loop()
    
>       with async_timeout.timeout(self.timeout):
E       TypeError: 'Timeout' object does not support the context manager protocol

Can I prepare PR deprecating async_timeout in favour of asyncio.timeout from your project?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions