Updating multiline output can insert invalid Python quote delimiters

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

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

2026年11月13日 から。

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

評価

難易度
3/5
見積もり時間
半日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
python
領域
testing

調査の方向性

The payload names run_print_update() and example.source but not the file that writes printed output back into examples, so search for run_print_update first. Reproduce with an example whose print output contains a triple-quote delimiter, in both the Markdown and Python-docstring variants. Done means example.source compiles after the update in both cases, and the output still matches the printed text.

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

説明

Reproduced on main at df945f7043cb8c456359b01700f3d664d30fbe44.

Multiline printed text is inserted between triple-quote delimiters without checking whether the text contains the chosen delimiter. An example printing a line of three double quotes in Markdown, or three single quotes in a Python docstring example, produces an early-closed or unterminated string after output updating.

With --update-examples enabled, update an example whose print output is first line, then the chosen triple-quote delimiter, then last line. Compile example.source after run_print_update(): it raises SyntaxError. Both Markdown and Python-docstring delimiter variants reproduce.

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

Contract: https://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals

Both delimiter regressions fail before the fix and pass afterward. The independently checked full local suite passes 83 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 を短くまとめたダイジェスト。