FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-155742: Use PyBytesWriter in json _match_number_unicode() by vstinner · Pull Request #155744 · python/cpython · GitHub

Repository navigation

gh-155742: Use PyBytesWriter in json _match_number_unicode() - #155744

Closed
vstinner wants to merge 1 commit into
python:mainfrom
vstinner:json_writer
Closed

vstinner wants to merge 1 commit into
python:mainfrom
vstinner:json_writer

Conversation

vstinner commented Aug 13, 2026 •
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Member

Replace soft deprecated PyBytes_FromStringAndSize() with PyBytesWriter.

Use PyBytesWriter_Create() for the float code path, or PyMem_Malloc() for the int code path.

Replace soft deprecated PyBytes_FromStringAndSize() with
PyBytesWriter.

Use PyBytesWriter_Create() for the float code path, or PyMem_Malloc()
for the int code path.
Comment thread Modules/_json.c
}
else {
writer = NULL;
buf = PyMem_Malloc(n + 1);

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

PyLong_FromString() doesn't need a bytes object, just a C string (char*). But maybe the PyLong code path should also use PyBytesWriter to simplify the code.

vstinner commented Sep 3, 2026

Copy link
Copy Markdown
Member Author

The alternative to creating a temporary bytes object is... to not create a Python object at all :-) I wrote PR gh-156897 for that.

Copy link
Copy Markdown
Member Author

I close this PR since PR #156897 seems to be a better approach.

vstinner closed this Sep 17, 2026
vstinner deleted the json_writer branch September 17, 2026 15:09
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

1 participant


Back | FazBrowse Home | New Git URL