Skip to content

gh-51338: Fix shlex to preserve newlines after comments in POSIX mode#141604

Open
kamilturek wants to merge 1 commit intopython:mainfrom
kamilturek:gh-51338
Open

gh-51338: Fix shlex to preserve newlines after comments in POSIX mode#141604
kamilturek wants to merge 1 commit intopython:mainfrom
kamilturek:gh-51338

Conversation

@kamilturek
Copy link
Copy Markdown
Contributor

@kamilturek kamilturek commented Nov 15, 2025

According to POSIX standard, newlines are NOT part of comments. Previously, shlex incorrectly consumed newlines when skipping comments, causing them to be lost even when excluded from the whitespace attribute.

If the current character is a '#', it and all subsequent characters up to, but excluding, the next <newline> shall be discarded as a comment. The <newline> that ends the line is not considered part of the comment.

https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_03

@kamilturek kamilturek marked this pull request as ready for review November 15, 2025 22:19
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 2, 2026

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label May 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review stale Stale PR or inactive for long period of time.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants