Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-134150: Clarify distinction between JSON and Python objects#134154

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
nedbat merged 3 commits intopython:mainfromMichaByte:json-docs-fix
May 18, 2025

Conversation

MichaByte
Copy link
Contributor

@MichaByteMichaByte commentedMay 17, 2025
edited by ZeroIntensity
Loading

This PR clears up the ambiguity between JSON objects and Python objects in thejson module docs by adding a note to inform the reader of the distinction. I also changed two occurrences of the word "specializing" with the word "customizing", since the latter seems to be a better fit for describing what's happening. Let me know if I need to make any changes!

Micha


📚 Documentation preview 📚:https://cpython-previews--134154.org.readthedocs.build/en/134154/library/json.html

@python-cla-bot
Copy link

python-cla-botbot commentedMay 17, 2025
edited
Loading

All commit authors signed the Contributor License Agreement.

CLA signed

Copy link
Contributor

@StanFromIrelandStanFromIreland left a comment
edited
Loading

Choose a reason for hiding this comment

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

Please avoid changes not related to the issue, we generally try to keep pull requests focused to make them easier to review.

This does not fully resolve this issue, there are several places in the docs where it should be clarified e.g. "object" -> "JSON object"

Edit:

I apologize for my review, I was tired and very inconsiderate. Welcome to contributing to cpython, I hope this will be one of many prs:-)

MichaByte reacted with heart emoji
(although it is not a strict subset of JavaScript [#rfc-errata]_ ).

.. note::
The term "object" in the context of JSON processing in Python can be
ambiguous. All values in Python are objects. In JSON, an object refers to
Copy link
Contributor

Choose a reason for hiding this comment

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

Glossary link to Python object?

Copy link
Member

Choose a reason for hiding this comment

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

In this case, I don't think a glossary link will help here. The reader in this case will know what a Python object is.

.. warning::
Be cautious when parsing JSON data from untrusted sources. A malicious
JSON string may cause the decoder to consume considerable CPU and memory
resources. Limiting the size of data to be parsed is recommended.

:mod:`json` exposes an API familiar to users of the standard library
This module exposes an API familiar to users of the standard library
Copy link
Contributor

Choose a reason for hiding this comment

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

Again unrelated, please revert and do not make a mess of this pr.

though it should be changed to

:mod:`!json`

Choose a reason for hiding this comment

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

do not make a mess of this pr.

@StanFromIreland Please be aware that this is a first-time contributor. Let's try to be more constructive by pointing to thedevguide.

StanFromIreland reacted with thumbs up emoji
Copy link
Member

Choose a reason for hiding this comment

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

I think "This module" make a better sentence anyway.

@@ -60,7 +65,7 @@ Pretty printing::
"6": 7
}

Specializing JSON object encoding::
Customizing JSON object encoding::
Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto

Copy link
Member

Choose a reason for hiding this comment

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

Again, I think this is a better word, and we don't want to make a separate PR for it, it would be too much churn.

@@ -83,7 +88,7 @@ Decoding JSON::
>>> json.load(io)
['streaming API']

Specializing JSON object decoding::
Customizing JSON object decoding::
Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto

@ZeroIntensityZeroIntensity added needs backport to 3.13bugs and security fixes needs backport to 3.14bugs and security fixes labelsMay 17, 2025
@MichaByte
Copy link
ContributorAuthor

CCing@nedbat, who helped me make these changes at PyCon

@nedbatnedbat merged commitfa4e088 intopython:mainMay 18, 2025
28 checks passed
@miss-islington-app
Copy link

Thanks@MichaByte for the PR, and@nedbat for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14.
🐍🍒⛏🤖

@github-project-automationgithub-project-automationbot moved this fromTodo toDone inDocs PRsMay 18, 2025
miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestMay 18, 2025
…ythonGH-134154)*pythongh-134150: Clarify distinction between JSON objects and Python objects in json module docs* Revert change to JSON introduction* Clarify occurrences of "object literal" as JSON(cherry picked from commitfa4e088)Co-authored-by: Micha Albert <micha@2231puppy.tech>
@bedevere-app
Copy link

GH-134166 is a backport of this pull request to the3.14 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestMay 18, 2025
…ythonGH-134154)*pythongh-134150: Clarify distinction between JSON objects and Python objects in json module docs* Revert change to JSON introduction* Clarify occurrences of "object literal" as JSON(cherry picked from commitfa4e088)Co-authored-by: Micha Albert <micha@2231puppy.tech>
@bedevere-appbedevere-appbot removed the needs backport to 3.14bugs and security fixes labelMay 18, 2025
@bedevere-app
Copy link

GH-134167 is a backport of this pull request to the3.13 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.13bugs and security fixes labelMay 18, 2025
nedbat pushed a commit that referenced this pull requestMay 18, 2025
…GH-134154) (#134167)gh-134150: Clarify distinction between JSON and Python objects (GH-134154)*gh-134150: Clarify distinction between JSON objects and Python objects in json module docs* Revert change to JSON introduction* Clarify occurrences of "object literal" as JSON(cherry picked from commitfa4e088)Co-authored-by: Micha Albert <micha@2231puppy.tech>
nedbat pushed a commit that referenced this pull requestMay 18, 2025
…GH-134154) (#134166)gh-134150: Clarify distinction between JSON and Python objects (GH-134154)*gh-134150: Clarify distinction between JSON objects and Python objects in json module docs* Revert change to JSON introduction* Clarify occurrences of "object literal" as JSON(cherry picked from commitfa4e088)Co-authored-by: Micha Albert <micha@2231puppy.tech>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@nedbatnedbatnedbat left review comments

@StanFromIrelandStanFromIrelandStanFromIreland left review comments

@ZeroIntensityZeroIntensityZeroIntensity approved these changes

Assignees
No one assigned
Labels
docsDocumentation in the Doc dirskip news
Projects
Status: Done
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@MichaByte@nedbat@ZeroIntensity@StanFromIreland

[8]ページ先頭

©2009-2025 Movatter.jp