Print checking swallows writes to explicit output streams

オープン
#96 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

@vinsymoyya がすでに取り組んでいます。

2026年11月13日 から。

  • #97 @vinsymoyya による — オープン

評価

難易度
3/5
見積もり時間
半日
初心者へのやさしさ
22/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python
領域
testing

調査の方向性

Start with the print interceptor that EvalExample.run_print_check() uses, and check how it handles the file keyword argument. Linked pull request #97 already targets this, so review its diff and discussion before writing anything. Done means the StringIO example from the issue passes, the stdout controls still pass, and the existing test suite stays green.

索引モデルが issue の本文から書いたものです。

説明

Reproduced on main at df945f7043cb8c456359b01700f3d664d30fbe44.

The print interceptor captures every call, including print(..., file=buffer). The destination never receives the text, so otherwise valid examples that use StringIO or another explicit text stream can fail their assertions.

from io import StringIO
buffer = StringIO()
print('hello', 'world', sep=':', end='!', file=buffer, flush=True)
assert buffer.getvalue() == 'hello:world!'

Run this through EvalExample.run_print_check(). The assertion fails because the buffer is empty.

Expected: checking/updating output preserves valid Python print semantics and produces compilable source.

Contract: https://docs.python.org/3/library/functions.html#print

The explicit-stream regression fails before the fix, while two stdout controls pass. All three pass afterward. The independently checked full local suite passes 84 tests with one expected failure and the known Windows object-address case deselected.

Relevant current and closed PR patches and issue discussions were checked; this does not duplicate the existing object-address, set-output, control-flow, metadata or indentation fixes.

主要言語
Python
スター
181
フォーク
31
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

pydantic/pytest-examples のほかの issue

pydantic/pytest-examples の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。