python / python/mypy

`report_internal_error` does not respect `stdout` and `stderr` in several places

Open
#10,240 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
20.6k
Forks
3.3k
PR merge metrics
PR metrics pending

Description

When using mypy as a library and passing stdout and stderr into build.build it is reasonable to expect that it will be respected for all cases.

But, there are several places where report_internal_error does not respect the passed value and just dumps everything into sys.stdout:

But, there also places where report_internal_error is called with the correct streams:

I suggest to add stdout and stderr props to Options class. It would be possible to easily work with them from all these three missed places.

Contributor guide

Open the contributing guide

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 tracing stdout and stderr from build.build through the Options class, then inspect the report_internal_error calls in checker.py, checkexpr.py, semanal.py, and build.py. Done means the three missed call sites use the passed streams rather than sys.stdout, while preserving the existing behavior in build.py.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.