Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TOML parsing regression in 1.1.386 #9297

Closed
InSyncWithFoo opened this issue Oct 23, 2024 · 1 comment
Closed

TOML parsing regression in 1.1.386 #9297

InSyncWithFoo opened this issue Oct 23, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@InSyncWithFoo
Copy link
Contributor

Steps to reproduce:

  1. On Windows, install uv.

  2. Run:

    $ git clone https://github.com/InSyncWithFoo/a-n-plus-b
    $ git reset --hard 400cea7
    $ cd a-n-plus
    $ uvx -p 3.11 tox

    (Alternatively, use Python 3.11 to create a virtual environment and run tox from that.)

Logs:

typecheck: commands[0]> mypy src --strict
Success: no issues found in 4 source files
typecheck: commands[1]> pyright src
npm notice
npm notice New minor version of npm available! 10.7.0 -> 10.9.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.9.0
npm notice To update run: npm install -g npm@10.9.0
npm notice

added 1 package, and audited 2 packages in 35s

found 0 vulnerabilities
Pyproject file parse attempt 1 error: {"name":"TomlError","fromTOML":true,"wrapped":null,"line":81,"col":33,"pos":1922}
Pyproject file parse attempt 2 error: {"name":"TomlError","fromTOML":true,"wrapped":null,"line":81,"col":33,"pos":1922}
Pyproject file parse attempt 3 error: {"name":"TomlError","fromTOML":true,"wrapped":null,"line":81,"col":33,"pos":1922}
Pyproject file parse attempt 4 error: {"name":"TomlError","fromTOML":true,"wrapped":null,"line":81,"col":33,"pos":1922}
Pyproject file parse attempt 5 error: {"name":"TomlError","fromTOML":true,"wrapped":null,"line":81,"col":33,"pos":1922}
Pyproject file parse attempt 6 error: {"name":"TomlError","fromTOML":true,"wrapped":null,"line":81,"col":33,"pos":1922}
Config file "d:\a\a-n-plus-b\a-n-plus-b\pyproject.toml" could not be parsed. Verify that format is correct.
0 errors, 0 warnings, 0 informations 
typecheck: exit 3 (51.97 seconds) D:\a\a-n-plus-b\a-n-plus-b> pyright src pid=6892
.pkg: _exit> python C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\pyproject_api\_backend.py True hatchling.build
py311: OK (43.61=setup[28.77]+cmd[14.84] seconds)
typecheck: FAIL code 3 (73.53=setup[19.98]+cmd[1.58,51.97] seconds)
evaluation failed :( (117.47 seconds)

The pyproject.toml file in question can be found here. Relevant lines (80 to 84, 0-indexed):

ignore = [
	"ANN101",    # missing-type-self
	"ANN102",    # missing-type-cls
	
	"COM812",    # missing-trailing-comma

This is only reproducible on Windows with Pyright 1.1.386, which uses @iarna/toml 3.0.0. The actual Python version is irrelevant, but, as declared, the typecheck environment requires 3.11.

The error can be replicated by passing the text to TOML.parse() manually:

TOML.parse(fs.readFileSync('pyproject.toml').toString())
Uncaught:
TomlError: Control characters (codes < 0x1f and 0x7f) are not allowed in comments, use \u000d instead at row 82, col 34, pos 1922:
81: ignore = [
82>     "ANN101",    # missing-type-self
                                     ^
83:     "ANN102",    # missing-type-cls


    at TOMLParser.errorControlCharIn (~\a-n-plus-b\node_modules\@iarna\toml\lib\toml-parser.js:737:25)
    at TOMLParser.parseComment (~\a-n-plus-b\node_modules\@iarna\toml\lib\toml-parser.js:390:22)
    at TOMLParser.runOne (~\a-n-plus-b\node_modules\@iarna\toml\lib\parser.js:64:30)
    at TOMLParser.parse (~\a-n-plus-b\node_modules\@iarna\toml\lib\parser.js:45:22)
    at Module.parseString (~\a-n-plus-b\node_modules\@iarna\toml\parse-string.js:13:12) {
  fromTOML: true,
  wrapped: null,
  line: 81,
  col: 33,
  pos: 1922
}
@InSyncWithFoo InSyncWithFoo added the bug Something isn't working label Oct 23, 2024
@InSyncWithFoo
Copy link
Contributor Author

Duplicate of #9296.

@InSyncWithFoo InSyncWithFoo closed this as not planned Won't fix, can't repro, duplicate, stale Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant