Skip to content

Bare typing.Tuple/List field crashes to_arrow_schema with AttributeError: __args__ #3502

Description

@devteamaegis

In _py_type_to_arrow_type the branch elif getattr(py_type, "__origin__", None) in (list, tuple) is taken for a bare, unparameterised typing.Tuple/typing.List (their __origin__ is tuple/list). The next line reads py_type.__args__[0], but a bare generic has no __args__, so it raises AttributeError: __args__.

from typing import Tuple
from lancedb.pydantic import LanceModel
class Doc(LanceModel):
    items: Tuple
Doc.to_arrow_schema()

Other unsupported types (e.g. Dict[str, int]) correctly raise a clear TypeError; the bare-generic case crashes with an opaque AttributeError instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions