[llvm] [lit] Use provided streams in builtin diff (PR #204869)

Prasoon Kumar via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 29 18:51:08 PDT 2026


================

----------------
prasoon054 wrote:

I looked into that, but unfortunately that won't work here. Because the fallback mode runs this directly as a standalone script (`python diff.py`), python sets `__package__` to `None`. If we try to use a relative import, it just throws an `ImportError`.
Additionally, the spawned fallback sets `PYTHONPATH` to the `lit/` directory itself, rather than its parent, so it doesn't even know it's part of the lit package.
The `try/except` block is the most robust workaround for now IMO. But that is strictly temporary, and will be removed entirely in the next commit.

https://github.com/llvm/llvm-project/pull/204869


More information about the llvm-commits mailing list