-
-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AttributeError
during fetching __orig_bases__
on non-generic protocol implementation.
#374
Comments
Can you show me the |
Will do so a bit later, thanks for responding! |
Here is an example I came up with; importing from attrs import define
from cattrs import Converter
from cattrs.gen import make_dict_unstructure_fn
from typing_extensions import Protocol
CONVERTER = Converter()
class SomeProtocol(Protocol):
...
@define()
class Entity(SomeProtocol):
...
CONVERTER.register_unstructure_hook(Entity, make_dict_unstructure_fn(Entity, CONVERTER)) |
AttributeError
during fetching of __orig_bases__
on non-generic protocol implementation.AttributeError
during fetching __orig_bases__
on non-generic protocol implementation.
I have the same error :-( |
Also seeing this error. There's a couple workarounds I tried that seem to work: Adding a no-op protocol as a base: _T = TypeVar("_T", covariant=True)
class _Protocol(Protocol[_T]):
...
class SomeProtocol(_Protocol[Any], Protocol):
...
@define()
class Entity(SomeProtocol):
... Adding a fake class SomeProtocol(Protocol):
__orig_bases__: ClassVar[tuple] = ()
...
@define()
class Entity(SomeProtocol):
... |
Alright, starting on this before wrapping up the next release. I think the problem is |
Description
I wanted to register an
unstructure
hook for anEntity
type derived from the non-genericBinary
protocol.What I Did
Which caused an error:
The text was updated successfully, but these errors were encountered: