Skip to content

BUG: fails to collect if a global variable is not __iter__able #507

Closed
@NickCrews

Description

@NickCrews

Not sure if this is the exact root cause or not.

First, pip install ibis-framework.
Then, in a task file have from ibis import _

This results in

────────────────────────────────────────────────── Could not collect tasks/task_other.py ───────────────────────────────────────────────────

╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /Users/nc/code/scg/kobuk/.venv/lib/python3.11/site-packages/ibis/common/deferred.py:96 in        │
│ __iter__                                                                                         │
│                                                                                                  │
│    93 │   │   return Deferred(Attr(self, name))                                                  │
│    94 │                                                                                          │
│    95 │   def __iter__(self):                                                                    │
│ ❱  96 │   │   raise TypeError(f"{self.__class__.__name__!r} object is not iterable")             │
│    97 │                                                                                          │
│    98 │   def __getitem__(self, name):                                                           │
│    99 │   │   return Deferred(Item(self, name))                                                  │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
TypeError: 'Deferred' object is not iterable

however, I tried to repro with putting this in the task file, and this does NOT error:

class NonIterable:
    def __iter__(self):
        raise TypeError("NonIterable is not iterable")


bad = NonIterable()

so not exactly sure the root cause.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions