GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Normalize lone CR to LF in str source for `exec()`, `eval()` and `-c` by Copilot · Pull Request #9762 · RustPython/RustPython

Conversation

Copilot AI commented Nov 9, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

When source is passed to exec() or eval() as a str, or via -c, a lone \r inside a string literal stays '\r'. CPython reads it as '\n', as it does for CRLF. The language reference says line-ending sequences are replaced by LF "even inside string literals". Docstrings with CR-only breaks also went uncleaned, and exec(text) differed from exec(text.encode()).

These paths skip the source decoder and reach compile_with_syntax_warning_handler, which only replaced "\r\n". The parser copies literal text from the source as is, so an unnormalized CR ended up in the value.

  • crates/compiler/src/lib.rs: compile_with_syntax_warning_handler now also replaces any remaining \r with \n, after the CRLF replacement.
eval('"""a\rb"""')   # before: 'a\rb'   after: 'a\nb'
  • The #[cfg(windows)] \r\n replacement near line 2082 is untouched.
  • No regression test is added.
  • Fixes exec(), eval() and -c keep a lone CR in string literals when the source is a str #9761

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Initial plan
7cefeaa
Copilot AI assigned Copilot and youknowone Nov 9, 2026
@coderabbitai

coderabbitai Bot commented Nov 9, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: RustPython/RustPython
  • Branch: main
  • File: .coderabbit.yml
  • Commit: a8bd43e
  • Layers: Repository YAML
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e3d7ce81-e8f1-49fd-a66c-ca5314f98de8

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

  • X
  • Mastodon
  • Reddit
  • LinkedIn
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Copilot started work on behalf of youknowone November 9, 2026 12:16
View session
Copilot AI linked an issue Nov 9, 2026 that may be closed by this pull request
exec(), eval() and -c keep a lone CR in string literals when the source is a str #9761
Open
@youknowone
Apply remaining changes
ee0b027
Co-authored-by: youknowone <[email protected]>
Copilot AI changed the title [WIP] Fix lone carriage return in string literals for exec and eval Normalize lone CR to LF in str source for exec(), eval() and -c Nov 9, 2026
Copilot finished work on behalf of youknowone November 9, 2026 12:26
Copilot AI requested a review from youknowone November 9, 2026 12:26
@youknowdot youknowdot mentioned this pull request Nov 10, 2026
Normalize source newlines before warnings, compilation and diagnostics #9793
Merged
@youknowone youknowone closed this in #9793 Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@youknowone youknowone Awaiting requested review from youknowone

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@youknowone youknowone

Copilot code review Copilot

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

exec(), eval() and -c keep a lone CR in string literals when the source is a str

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@youknowone
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.