Skip to content

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

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

gh-155742: Use PyBytesWriter in json _match_number_unicode()#155744
vstinner wants to merge 1 commit into
python:mainfrom
vstinner:json_writer

Conversation

@vstinner

@vstinner vstinner commented Aug 13, 2026

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.

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.

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