OSlash icon indicating copy to clipboard operation
OSlash copied to clipboard

3.12.2 python problem with Functor subclass check

Open banderlog opened this issue 1 year ago • 4 comments

Hi, the next error appears on python3.12.2:

 File "/venv/lib/python3.12/site-packages/oslash/_init_.py", line 11, in <module>
    from .state import State
  File "/venv/lib/python3.12/site-packages/oslash/state.py", line 78, in <module>
    assert issubclass(State, Functor)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/typing.py", line 1841, in _subclasscheck_
    cls._non_callable_proto_members_
AttributeError: type object 'Functor' has no attribute '_non_callable_proto_members_'

with 3.11 everything is fine

oslash-0.6.3 (latest)

banderlog avatar Apr 20 '24 09:04 banderlog

UPD: it is the problem of combination of python and typing-extensions

python-3.12 with typing-extensions>4.9.0 fails
python-3.10 and python-3.11 works fine with typing-extensions>=4.9.0

banderlog avatar Apr 20 '24 11:04 banderlog

https://github.com/python/typing_extensions/issues/372#issuecomment-2067787722

Thanks. This happens because you're mixing typing.Protocol with typing_extensions.runtime_checkable. If you either import both symbols from typing or both symbols from typing_extensions, the error goes away.

banderlog avatar Apr 20 '24 21:04 banderlog

I know I might be asking for too much, but do you have any timeline in mind to publish a fix soon? I'm experiencing this exact error and would like to get it fixed soon. Thanks in advance. @banderlog

simonzg avatar May 08 '24 00:05 simonzg

@simonzg https://github.com/dbrattli/OSlash/pull/36

or hardcode specific version typing-extensions==4.9.0 in requirements/toml file

also, typing-extensions now have 4.11 version, in which it might be fixed already

banderlog avatar May 08 '24 06:05 banderlog