configparser: reading an invalid file triggers ParsingError *and* mutations
まだ誰も着手していません。
評価
調査の方向性
トレースバックに示されている configparser.py の実装から始め、issue の read_string の例を再現します。ParsingError が発生する前に _read が有効な行をどのように処理するかを追跡し、その後、失敗ケースに対する焦点を絞ったテストを追加するか、既存のものを見つけます。無効な入力が ParsingError を発生させ、ConfigParser オブジェクトに部分的な内容を残さなければ完了です。
索引モデルが issue の本文から書いたものです。
説明
Bug report
A clear and concise description of what the bug is.
Include a minimal, reproducible example (https://stackoverflow.com/help/minimal-reproducible-example), if possible.
Your environment
- CPython versions tested on: 3.11.0b5
- Operating system and architecture: x86_64
here is a simple example:
>>> import configparser
>>> cfg = configparser.ConfigParser()
>>> cfg.read_string('[foo]\nx = 1\n...\n')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.11/configparser.py", line 738, in read_string
self.read_file(sfile, source)
File "/usr/lib/python3.11/configparser.py", line 733, in read_file
self._read(f, source)
File "/usr/lib/python3.11/configparser.py", line 1131, in _read
raise e
configparser.ParsingError: Source contains parsing errors: '<string>'
[line 3]: '...\n'
>>> cfg['foo']['x']
'1'
I expect reading to be an all-or-nothing operation -- if the file contains a syntax error it shouldn't modify the ConfigParser object with half of the file's contents
- 主要言語
- Python
- スター
- 77.2k
- フォーク
- 36k
- 平均マージ
- 1日 9時間
- マージ済み PR(30日)
- 558
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
python/cpython のほかの issue
-
docs pending
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
stdlib type-feature
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
stdlib type-feature
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
build type-bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
-
stdlib topic-email type-feature
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
似ている issue
-
area/auth bug comp/agent P3 platform/discord type/security
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
NousResearch/hermes-agent#117848 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
bancolombia/sentinel#23 ·
-
test md オープンCI
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
langchain-ai/deepagents#6450 ·
-
bug client
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100