> async and await are now reserved keywords.
so unless the author is using async/await as variable names (and i wonder why they would), 3.5 code is going to run as expected.
> async and await are now reserved keywords.
so unless the author is using async/await as variable names (and i wonder why they would), 3.5 code is going to run as expected.
Kubernetes-cli did, [0] inadvertently due to code generated by Swagger. [1]
That doesn't mean only that project either - it means anything _depending_ (not necessarily directly!) on it is also broken under 3.7. [2]
[0]: https://github.com/kubernetes-client/python/issues/558
[1]: https://github.com/swagger-api/swagger-codegen/pull/8401
[2]: It bit me.
class SomeMetaClass:
def __new__(name, bases, attrs):
pass
class SomeClass(metaclass=SomeMetaClass):
pass
Now suppose that SomeClass needs to use the typing module's mechanism for indicating a generic, so you could do an annotation like "SomeClass[SomeOtherType]". So you'd want to have SomeClass be a subclass of, typing.Generic[T]. That would, in Python 3 prior to 3.7, raise a TypeError due to metaclass conflict -- the generics in the typing module had their own base metaclasses. So you actually had to define an intermediate class to resolve the metaclass conflict, and do like so: class IntermediateMeta(SomeMetaClass, typing.GenericMeta):
pass
class SomeClass(metaclass=IntermediateMeta):
pass
(this was weird and rare and GenericMeta was never documented)Python 3.7 implemented PEP 560, which introduced the __class_getitem__ hook for implementing the behavior GenericMeta used to handle, and doing away with the need for the typing generics to use GenericMeta as their metaclass. So GenericMeta exists in Python 3.5 and 3.6, but no longer exists in Python 3.7, and anything which tries to reference it will break.
import asyncio
@asyncio.async # SyntaxError in 3.7
def my_coroutine(...): ...
And since asyncio is one of the strongest reason to migrate to python 3.x, I bet far less than 99.99% of code written for 3.4/3.5 can be run on 3.7 with no changes.Luckly, 99% of changes were trivial. Other 1% is a nightmare.