llvm / llvm/circt

[Python] Connect Python's standard error stream to C++ errors

Open
#1,983 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Python
Dominant language
C++
Stars
2.2k
Forks
524
Avg merge
3d 2h
Merged PRs (30d)
46

Description

This came up and was worked around in #1981. From @teqdruid's comment on that PR:

The right way to deal with this is by providing a mechanism in MLIR to redirect its stderr to an arbitrary llvm:raw_ostream so it can be redirected to python... I don't know if that's possible, but I would imagine it is.

We should look into this so Python and C++ can share an error stream, and remove the hack from #1981 to manually flush Python's sys.stderr from the tests.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the workaround in #1981 and @teqdruid's linked comment about redirecting MLIR errors to an arbitrary llvm::raw_ostream. Investigate how Python and C++ could share an error stream, then verify that the manual Python sys.stderr flush hack can be removed from the tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.