-
Notifications
You must be signed in to change notification settings - Fork 237
Closed
Description
Initial Checks
- I have read and followed the docs and still think this is a bug
Description
TypeError for issubclass in python 3.10. Works in python 3.11.
I think it is due to usage of issubclass that is missed out in the following.
docarray/docarray/base_doc/doc.py
Lines 328 to 330 in 75e0033
| type_ = self._get_field_annotation(field) | |
| if isinstance(type_, type) and issubclass(type_, AnyDocArray): | |
| doclist_exclude_fields.append(field) |
Traceback (most recent call last):
File "/.../test.py", line 12, in <module>
item.model_dump()
File "/.../lib/python3.10/site-packages/docarray/base_doc/doc.py", line 520, in model_dump
return _model_dump(super())
File "/.../lib/python3.10/site-packages/docarray/base_doc/doc.py", line 488, in _model_dump
) = self._exclude_doclist(exclude=exclude)
File "/.../lib/python3.10/site-packages/docarray/base_doc/doc.py", line 329, in _exclude_doclist
if isinstance(type_, type) and issubclass(type_, AnyDocArray):
File "/.../lib/python3.10/abc.py", line 123, in __subclasscheck__
return _abc_subclasscheck(cls, subclass)
TypeError: issubclass() arg 1 must be a class
Example Code
from __future__ import annotations
from docarray import BaseDoc, __version__
class Document(BaseDoc):
list_str: list[str]
item = Document(list_str=["a", "b", "c"])
item.model_dump()Python, DocArray & OS Version
python: 3.10
docarray: 0.40.0
platform: macOS-14.6.1-x86_64-i386-64bit
Affected Components
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels