Skip to content

reject tab characters in bare keys#497

Open
netliomax25-code wants to merge 1 commit into
python-poetry:masterfrom
netliomax25-code:reject-tab-in-bare-key
Open

reject tab characters in bare keys#497
netliomax25-code wants to merge 1 commit into
python-poetry:masterfrom
netliomax25-code:reject-tab-in-bare-key

Conversation

@netliomax25-code

Copy link
Copy Markdown
Contributor
  1. _parse_bare_key consumes spaces and tabs while reading a bare key, then strips outer whitespace and only rejects the key if it still contains a literal space, so an interior tab is never caught.
  2. As a result bare keys, dotted-key segments and table names with embedded tabs are accepted (a\tb = 1, [a\tb], x.y\tz = 1), which the spec disallows and which stdlib tomllib and the official toml-test corpus reject.

Changed the check to reject the key when the stripped value contains a space or a tab. Validation stays in the parser since callers receive the already-built key.

Verified against the failing inputs above, the existing parser tests, and the full toml-test suite. Added a regression test that fails before the change and passes after.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant