| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Replace PyBytes_FromStringAndSize(NULL, 0) with Py_GetConstant(Py_CONSTANT_EMPTY_BYTES).
There was a problem hiding this comment.
Please wait.
Sorry, something went wrong.
There was a problem hiding this comment.
I am not comfortable with this change.
In summary, this is a cosmetic change which makes the code more difficult to maintain without significant gain.
Sorry, something went wrong.
Py_GetConstant() returns a new reference: https://docs.python.org/dev/c-api/object.html#c.Py_GetConstant |
Sorry, something went wrong.
|
Oh, nice. That eliminates most of my objections. There is still an issue with reasoning such change. This look like change for the sake of change. |
Sorry, something went wrong.
|
I would like to get rid of PyBytes_FromStringAndSize(NULL, size) calls which create an incomplete bytes object, but PyBytes_FromStringAndSize(NULL, 0) doesn't have this issue. Py_GetConstant(Py_CONSTANT_EMPTY_BYTES) is simpler and a little bit faster than PyBytes_FromStringAndSize(NULL, 0). In general, I would prefer to make Py_GetConstant(Py_CONSTANT_EMPTY_BYTES) the reference function to get an empty byte string. |
Sorry, something went wrong.
Sorry, something went wrong.
|
I failed to convince @serhiy-storchaka, so I just close my PR. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Replace PyBytes_FromStringAndSize(NULL, 0)
with Py_GetConstant(Py_CONSTANT_EMPTY_BYTES).