-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
PEP 782: Add PyBytesWriter C API #4325
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
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
AA-Turner
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Brief editorial review:
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Examples becomes a top-level section.
|
@AA-Turner: I updated the PEP, please review it again. |
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
picnixz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the examples, it could help if you could add comments telling what happens if we were to call PyBytesWriter_Finish() after each call to a PyBytesWriter_* writing function. For instance in the hello world case:
PyObject* hello_world(void)
{
PyBytesWriter *writer = PyBytesWriter_Create(0);
if (writer == NULL) {
goto error;
}
// PyBytesWriter_Finish(writer) == b""
if (PyBytesWriter_WriteBytes(writer, "Hello", -1) < 0) {
goto error;
}
// PyBytesWriter_Finish(writer) == b"Hello"
if (PyBytesWriter_Format(writer, " %s!", "World") < 0) {
goto error;
}
// PyBytesWriter_Finish(writer) == b"Hello World!"
return PyBytesWriter_Finish(writer);
error:
PyBytesWriter_Discard(writer);
return NULL;
}Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Basic requirements (all PEP Types)
pep-NNNN.rst), PR title (PEP 123: <Title of PEP>) andPEPheaderAuthororSponsor, and formally confirmed their approvalAuthor,Status(Draft),TypeandCreatedheaders filled out correctlyPEP-Delegate,Topic,RequiresandReplacesheaders completed if appropriate.github/CODEOWNERSfor the PEPStandards Track requirements
Python-Versionset to valid (pre-beta) future Python version, if relevantDiscussions-ToandPost-History📚 Documentation preview 📚: https://pep-previews--4325.org.readthedocs.build/