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-134717: Allow overriding serialization of NaN and Infinity in json.encoder#134715

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

Open
krzyszti wants to merge3 commits intopython:main
base:main
Choose a base branch
Loading
fromkrzyszti:patch-1

Conversation

krzyszti
Copy link

@krzysztikrzyszti commentedMay 26, 2025
edited by bedevere-appbot
Loading

This change modifies thejson.encoder module to permit customization of how special floating-point values (NaN,Infinity,-Infinity) are serialized. By introducing afloatstr function, developers can now define alternative representations for these values, such asnull,0, or custom strings, enhancing flexibility in JSON output.

This change can allow the programmer to override Nan/Infinity/-Infinity to be not only NaN but null, 0 or whatever they want it to be.
@python-cla-bot
Copy link

python-cla-botbot commentedMay 26, 2025
edited
Loading

All commit authors signed the Contributor License Agreement.

CLA signed

@bedevere-app
Copy link

Most changes to Pythonrequire a NEWS entry. Add one using theblurb_it web app or theblurb command-line tool.

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

@krzysztikrzyszti changed the titlegh-112517: Allow overriding serialization of NaN and Infinity in json.encodergh-134717: Allow overriding serialization of NaN and Infinity in json.encoderMay 26, 2025
@bedevere-app
Copy link

Most changes to Pythonrequire a NEWS entry. Add one using theblurb_it web app or theblurb command-line tool.

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

@bedevere-app
Copy link

Most changes to Pythonrequire a NEWS entry. Add one using theblurb_it web app or theblurb command-line tool.

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

Copy link
Contributor

@sharktidesharktide left a comment

Choose a reason for hiding this comment

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

@krzyszti
The news entry here is in the wrong place and format. Please move it to /next/Library/ and useblurb orblurb it to create the entry. The content {of the news entry} looks fine though

Copy link
Contributor

@sharktidesharktide left a comment

Choose a reason for hiding this comment

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

self isn't defined here either

@nineteendo
Copy link
Contributor

Also keep in mind that the C implementation will still be called if you override floatstr.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@sharktidesharktidesharktide requested changes

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@krzyszti@nineteendo@sharktide

[8]ページ先頭

©2009-2025 Movatter.jp