Skip to content

Dynamically computed __all__ gets treated in the same way as empty __all__ #2560

@grievejia

Description

@grievejia

Describe the Bug

Minimal repro:

# foo/__init__.py
a: int = 0
__all__ = [x for x in ["a"]]

# [test.py](http://test.py/)
from foo import *
print(a)  # Pyrefly FP: this should be findable

I think it's reasonable to emit a warning if __all__ is unresolvable statically (as warnings -- Pyright does this). But Pyrefly currently treats this in the same way as if __all__ = [] which is clearly problematic.

Sandbox Link

https://pyrefly.org/sandbox/?project=N4IgZglgNgpgziAXKOBDAdgEwEYHsAeAdAA4CeS4ATrgLYAEYuudENxulALnQFQA66AcUoR0nABSoAlCAA0IMpRhgopQp1pQKAYjoAFUkpWk6aLHnx0AxrnSQA5gFdKqThFuEBugMowYdAAtOTmI4RAB6cMVlVUIOe3CYdHDMXCs4cJs7CCcXN1twhg46VAA3VGhUbFhrWwdnV3d0OlxifPQ4T3QyTgDbAFpSmEo4JroAXjo%2BEABmQgBGACZpgTlwJnCAfU3RCE5tknJEEFREFjEJugAGAQFt1CgobcuAbUtGSjpLUSmT6YBdEAAX3kqCsbiGADFoDAKGYcARDsCgA

Metadata

Metadata

Assignees

Labels

typecheckingusabilityUsability & readiness issues identified with running Pyrefly on top OSS projects

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions