
On Sat, Feb 20, 2021 at 4:32 PM Richard van der Hoff <richard@matrix.org> wrote:
from twisted.python import log Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/synapse/env3/lib/python3.5/site-packages/twisted/python/log.py",
(env3)rav@faith:~$ python3 Python 3.5.2 (default, Oct 7 2020, 17:19:02) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information. line 20, in <module> from twisted.python import reflect File "/home/synapse/env3/lib/python3.5/site-packages/twisted/python/reflect.py", line 377, in <module> def _safeFormat(formatter: Union[types.FunctionType, Type[str]], o: object) -> str: File "/usr/lib/python3.5/typing.py", line 552, in __getitem__ dict(self.__dict__), parameters, _root=True) File "/usr/lib/python3.5/typing.py", line 512, in __new__ for t2 in all_params - {t1} if not isinstance(t2, TypeVar)): File "/usr/lib/python3.5/typing.py", line 512, in <genexpr> for t2 in all_params - {t1} if not isinstance(t2, TypeVar)): File "/usr/lib/python3.5/typing.py", line 1077, in __subclasscheck__ if super().__subclasscheck__(cls): File "/usr/lib/python3.5/abc.py", line 225, in __subclasscheck__ for scls in cls.__subclasses__(): TypeError: descriptor '__subclasses__' of 'type' object needs an argument
Awww, this is unfortunate. It looks like our CI on GitHub Actions is testing *Python 3.5.10*. Over the past year, we have added a lot of type annotations to the codebase, and it has been a struggle to still keep things working with Python 3.5, but looks like between Python 3.5.2 and 3.5.10 there were changes to Python in this area. On Sat, Feb 20, 2021 at 4:50 PM Richard van der Hoff <richard@matrix.org> wrote:
It also breaks compat with treq 20.4 and earlier. This may or may not be a thing you care about:
File "/home/rav/work/synapse/synapse/http/client.py", line 33, in <module> import treq File "/home/rav/work/synapse/env3/lib/python3.8/site-packages/treq/__init__.py", line 5, in <module> from treq.api import head, get, post, put, patch, delete, request File "/home/rav/work/synapse/env3/lib/python3.8/site-packages/treq/api.py", line 5, in <module> from treq.client import HTTPClient File "/home/rav/work/synapse/env3/lib/python3.8/site-packages/treq/client.py", line 11, in <module> from twisted.python.compat import _PY3, unicode ImportError: cannot import name '_PY3' from 'twisted.python.compat' (unknown location)
This has been fixed in newer versions of treq. Since _PY3 is prefixed by an underscore, theoretically it should not be used outside of Twisted......that means other subprojects of twisted which are not twisted/twisted! Well it looks like we are not 100% hiccup free when people upgrade, but unfortunately, the show must go on, and I guess people will have to pin to earlier versions of Python, or upgrade their code if they run into things like this. Thank you very much for testing, and providing feedback!! -- Craig