-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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 1.0.0 parser used in latest release 1.1.285 fails to parse line endings of comments #4367
Comments
I'm not able to repro the problem you're reporting. Can you confirm that when you paste the above text into a fresh Is it possible that you have mixed line endings in your file (e.g. CR for some lines and CR/LF in others)? |
Hi Eric, |
OK, I was able to repro the problem by converting it from CR to CRLF line endings. The latter is default on Windows, whereas the former is default on Mac and Linux. The problem occurs only if there is a comment in the file. Yes, this looks like a bug in the TOML parser. I can report the bug to the maintainer, but it looks like it is not very actively maintained, so I suspect it will be a long time before it will be updated. I think we have a couple of options here:
Since this affects all Windows users, my inclination is to go with option 1. Thoughts? @smackesey, since you reported the other issue, I'm interested in your thoughts too. |
It looks like this is a known issue, and it has even been fixed already, but no new release has been published since that time. |
Well really both options are quite bad, since they result in broken TOML parsing. I don't really have a personal dog in the fight since I stopped using the Perhaps the best option would be to temporarily vendor the master of the TOML parser where the issue has been fixed? Or, and I forget if npm/yarn allow this, set the dependency to an unpublished commit from github? Or maybe take another look at the options for 1.0-compliant parsers. |
Hi Eric, either fine for me. Take your time. I have, as a temporary solution on my end, nailed pyright to v1.1.284 in the CI workflows. This will work for me until next release of pyright with then possibly a permanent fix implemented. Best regards Claas |
@smackesey, I don't see a good option here. Vendoring isn't something we generally do because it defeats all vulnerability tracking mechanisms in github. There are no other good TOML 1.0 parsers available currently. FWIW, I resisted adding support for pyproject.toml for a long time in pyright because I feared it would be a support burden. I still have mixed feelings about it. On the one hand, may pyright users like the ability to use pyproject.toml rather than pyrightconfig.json, but my concerns about support are proving somewhat true. I'm going to revert the previous change for now. |
@erictraut @smackesey @frl000 If there are really no good TOML 1.0 parsers out there despite a community need, we could think about adding support for toml to dictIO . Just 'thinking out loud'; but not impossible. Maybe there is someone out there who would like to contribute? |
This is included in pyright 1.1.286, which I just published. It will also be included in a future version of pylance. |
Note: if you are reporting a wrong signature of a function or a class in the standard library, then the typeshed tracker is better suited for this report: https://github.com/python/typeshed/issues.
Describe the bug
line endings of comments in pyproject.toml lead to parse error.
To Reproduce
use pyproject.toml with following content:
run pyright .
Following error returned on console log:
Expected behavior
Line Endings of Line comments should not be parsed as non-allowed control characters, but removed before the check for control characters is executed.
Screenshots or Code
see excerpts above
VS Code extension or command-line
command-line
Additional context
The text was updated successfully, but these errors were encountered: