Skip to content

gh-59598: Ignore leading whitespace in JSONDecoder.raw_decode #117397

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

crazymerlyn
Copy link

@crazymerlyn crazymerlyn commented Mar 31, 2024

@ghost
Copy link

ghost commented Mar 31, 2024

All commit authors signed the Contributor License Agreement.
CLA signed

@bedevere-app
Copy link

bedevere-app bot commented Mar 31, 2024

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

Copy link
Contributor

@eendebakpt eendebakpt left a comment

Choose a reason for hiding this comment

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

Two small comments, but overall looks good.

@bedevere-app
Copy link

bedevere-app bot commented Apr 22, 2024

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@crazymerlyn
Copy link
Author

Updated the code to make the matching function an argument and removed the extra call.

@eendebakpt
Copy link
Contributor

@crazymerlyn Thanks for the updates. Your pr still requires a news entry. The easiest way to add this is to use click on the Details button next to the failing bedevere/news in the list of CI checks.

Also see https://devguide.python.org/core-developers/committing/#how-to-add-a-news-entry

@crazymerlyn
Copy link
Author

added a news entry

@crazymerlyn
Copy link
Author

@eendebakpt Updated with the suggested change.

@eendebakpt
Copy link
Contributor

eendebakpt commented May 7, 2024

@crazymerlyn I read the corresponding issue and opinions on whether we should make this change or not (at least back in 2016!) are not unanimous. A core developer should decide whether to accept this or not. The code in the PR looks good to me.

Since this PR is not backwards compatible and there has been some discussion it is good to update the documentation (e.g. here https://docs.python.org/3/library/json.html#json.JSONDecoder.raw_decode) and add a Changed in version x.xx section (for an example see https://docs.python.org/3/library/bisect.html#bisect.bisect)

Whitespace is allowed before JSON objects according to RFC 4627.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JSONDecoder.raw_decode breaks on leading whitespace
2 participants