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 — gh-97556: Raise null bytes syntax error upon null in multiline string by lysnikolaou · Pull Request #104136 · python/cpython

Conversation

@lysnikolaou

@lysnikolaou lysnikolaou commented May 3, 2023 •
edited by bedevere-bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Member
  • Issue: Null characters in strings cause a C SystemError #97556

Sorry, something went wrong.

Uh oh!

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

All reactions
@lysnikolaou
pythongh-97556: Raise null bytes syntax error upon null in multiline …
fa7a709
…string
@lysnikolaou
lysnikolaou requested a review from pablogsal as a code owner May 3, 2023 15:03
@bedevere-bot bedevere-bot mentioned this pull request May 3, 2023
Null characters in strings cause a C SystemError #97556
Closed
@bedevere-bot bedevere-bot added the awaiting core review label May 3, 2023
@lysnikolaou lysnikolaou added the skip news label May 3, 2023
@lysnikolaou
Handle f-strings correctly as well
78fbd3c
pablogsal
pablogsal approved these changes May 3, 2023
View reviewed changes

@pablogsal pablogsal left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Maybe we should add sone asserts here and there that tok->done is not error to prevent this issue from happening in other places

Sorry, something went wrong.

Uh oh!

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

All reactions
@bedevere-bot bedevere-bot added awaiting merge and removed awaiting core review labels May 3, 2023
@lysnikolaou

lysnikolaou commented May 4, 2023 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member Author

Maybe we should add sone asserts here and there that tok->done is not error to prevent this issue from happening in other places

That's a good idea. Where would you add these asserts though, since most of the time we shouldn't be asserting, but rather check for it?

One of the items I have in my to-do list is to add comments and assert in various places in the tokenizer to make the logic a bit easier to follow. Would it be okay to merge this as-is and then do that in a separate PR?

All reactions

Sorry, something went wrong.

Uh oh!

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

@pablogsal

pablogsal commented May 4, 2023

Copy link
Copy Markdown
Member

Would it be okay to merge this as-is and then do that in a separate PR?

Absolutely, let's merge this as is 🚀

Great job as always man!

lysnikolaou reacted with heart emoji
All reactions
  • ❤️ 1 reaction

Sorry, something went wrong.

Uh oh!

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

@lysnikolaou
lysnikolaou merged commit ef0df52 into python:main May 4, 2023
@bedevere-bot bedevere-bot removed the awaiting merge label May 4, 2023
@lysnikolaou
lysnikolaou deleted the null-bytes-multiline-string branch May 4, 2023 12:26
@vstinner

vstinner commented May 4, 2023

Copy link
Copy Markdown
Member

@lysnikolaou: Do you consider backporting your change to Python 3.11?

All reactions

Sorry, something went wrong.

Uh oh!

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

@bskinn

bskinn commented May 4, 2023 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

See discussion linked in the associated issue, there was a decision made not to backport the initial change that worked for single quoted strings, to avoid breaking compatibility in a patch version release.

All reactions

Sorry, something went wrong.

Uh oh!

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

@bskinn

bskinn commented May 4, 2023

Copy link
Copy Markdown
Contributor

See #96670 (comment)

All reactions

Sorry, something went wrong.

Uh oh!

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

@lysnikolaou lysnikolaou added the needs backport to 3.11 only security fixes label May 4, 2023
@miss-islington miss-islington assigned lysnikolaou May 4, 2023
@lysnikolaou lysnikolaou removed the needs backport to 3.11 only security fixes label May 4, 2023
@lysnikolaou

lysnikolaou commented May 4, 2023

Copy link
Copy Markdown
Member Author

FYI I removed the label until it's more clear what should be backported.

All reactions

Sorry, something went wrong.

Uh oh!

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

@python python deleted a comment from miss-islington May 5, 2023
@python python deleted a comment from miss-islington May 5, 2023
@lysnikolaou

lysnikolaou commented May 5, 2023

Copy link
Copy Markdown
Member Author

GH-104195 includes a backport of this commit to 3.11.

All reactions

Sorry, something went wrong.

Uh oh!

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

@ashm-dev ashm-dev mentioned this pull request Nov 1, 2026
gh-97556: Fix crash on null characters in string literal parser #97577
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@pablogsal pablogsal pablogsal approved these changes

Uh oh!

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

Assignees

@lysnikolaou lysnikolaou

Labels

skip news

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

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

5 participants

@lysnikolaou @pablogsal @vstinner @bskinn @bedevere-bot
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.