Polyconseil / aioamqp

AMQP implementation using asyncio
Other
280 stars 88 forks source link

Python 3.7 support - support for <3.4.4 needs to be dropped #160

Closed mikmatko closed 6 years ago

mikmatko commented 6 years ago

compat.py:

import asyncio

try:
    from asyncio import ensure_future
except ImportError:
    ensure_future = asyncio.async

async is a reserved keyword in Python 3.7 so this will always result in a SyntaxError. This happens before the try/except block, so it cannot be handled properly backwards-compatible as far as I know.

asyncio.ensure_future was added in Python 3.4.4 and asyncio.async was deprecated then. See https://docs.python.org/3.4/library/asyncio-task.html#asyncio.ensure_future

Basically, to have Python 3.7 support, support for <3.4.4 needs to be dropped. Since there is nothing else in compat.py, it can be completely removed.

dzen commented 6 years ago

Woopsi, wrong click.

you're right, we must drop python 3.4 support. It's already followed on this issue :https://github.com/Polyconseil/aioamqp/issues/123 We should avoid duplicate issue, so I'm closing this issue.

RemiCardona commented 6 years ago

We can support 3.4 and 3.7.

We need to do something like this https://github.com/aaugustin/websockets/blob/master/websockets/compatibility.py#L11-L15

@mikmatko patch welcome !

mikmatko commented 6 years ago

We can support 3.4 and 3.7. We need to do something like this https://github.com/aaugustin/websockets/blob/master/websockets/compatibility.py#L11-L15

You are absolutely right. How did I miss that.. I'm an idiot. Submitted PR: #161 Thank you!

RemiCardona commented 6 years ago

Thanks a bunch for your contribution. Cheers.