Skip to content

AsyncioBackend: DeprecationWarning for StreamReader/StreamWriter in Py3.8 #256

Description

@florimondmanca

Python 3.8 builds are filled with warnings about asyncio API changes: https://travis-ci.org/encode/httpx/jobs/574559125

Looks like as as of Python 3.8, asyncio.open_connection() is deprecated in favor of asyncio.connect() — see the asyncio 3.8+ docs.

# < 3.8
reader, writer = await asyncio.open_connection('127.0.0.1', 8888)

# 3.8+
async with asyncio.connect('127.0.0.1', 8888) as stream:
    ...
# or:
stream = await asyncio.connect('127.0.0.1', 8888)

This is not a trivial API change, and I don't know if there are plans to back-port asyncio.connect() to 3.7 and below.

So at first glance resolving this would need to adapt the .connect() method on AsyncioBackend to use one or the other depending on the Python version we're running on — and also make Reader/Writer pair (and soon Stream) handle both possibilities ?

Originally raised in: #255 (comment)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions