Skip to content
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

Incompatible With Type Hinting Generics In Standard Collections #66

Closed
songzhi opened this issue Dec 8, 2020 · 1 comment · Fixed by #240
Closed

Incompatible With Type Hinting Generics In Standard Collections #66

songzhi opened this issue Dec 8, 2020 · 1 comment · Fixed by #240
Labels
bug Something isn't working

Comments

@songzhi
Copy link

songzhi commented Dec 8, 2020

from odmantic import Model

class User(Model):
    scopes: list[str]


print(User(scopes=[]))

Caused errors like this:

Traceback (most recent call last):
  File "C:\xxxx\main.py", line 3, in <module>
    class User(Model):
  File "C:\xxxx\lib\site-packages\odmantic\model.py", line 381, in __new__
    mcs.__validate_cls_namespace__(name, namespace)
  File "C:\xxxx\lib\site-packages\odmantic\model.py", line 219, in __validate_cls_namespace__
    substituted_type = validate_type(field_type)
  File "C:\xxxx\lib\site-packages\odmantic\model.py", line 176, in validate_type
    setattr(type_, "__args__", new_arg_types)
AttributeError: readonly attribute
@art049 art049 added the bug Something isn't working label Dec 11, 2020
@MatthewNewland

This comment was marked as off-topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants