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

Don't swallow trailing whitespace #976

Merged
merged 2 commits into from
Jul 18, 2023
Merged

Don't swallow trailing whitespace #976

merged 2 commits into from
Jul 18, 2023

Conversation

zsol
Copy link
Member

@zsol zsol commented Jul 17, 2023

Summary

This PR fixes swallowing of whitespace trailing the module (aka footer) in case of no newlines at the end of the file.

Test Plan

Added a test case

zsol added 2 commits May 28, 2023 23:02
When the input doesn't have a trailing newline, but the last line had
exactly the amount of bytes as the current indentation level, the
tokenizer didn't emit a fake newline, causing parse errors (the grammar
expects newlines to conform with the Python spec).

I don't see any reason for fake newlines to be omitted in these cases,
so this PR removes that condition from the tokenizer.

Reported in #930.
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jul 17, 2023
@codecov-commenter
Copy link

Codecov Report

Patch and project coverage have no change.

Comparison is base (59aeceb) 90.92% compared to head (ef1801a) 90.92%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #976   +/-   ##
=======================================
  Coverage   90.92%   90.92%           
=======================================
  Files         254      254           
  Lines       25937    25962   +25     
=======================================
+ Hits        23584    23607   +23     
- Misses       2353     2355    +2     

see 10 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@zsol zsol merged commit 0fb9021 into main Jul 18, 2023
22 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants