gh-115754: Use Py_GetConstant(Py_CONSTANT_EMPTY_BYTES) (#125195)

Replace PyBytes_FromString("") and PyBytes_FromStringAndSize("", 0)
with Py_GetConstant(Py_CONSTANT_EMPTY_BYTES).
This commit is contained in:
Victor Stinner 2024-10-09 17:12:11 +02:00 committed by GitHub
parent 3ee474f568
commit 6a39e96ab8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 9 additions and 9 deletions

View file

@ -1541,7 +1541,7 @@ _PyPegen_concatenate_strings(Parser *p, asdl_expr_seq *strings,
}
if (bytes_found) {
PyObject* res = PyBytes_FromString("");
PyObject* res = Py_GetConstant(Py_CONSTANT_EMPTY_BYTES);
/* Bytes literals never get a kind, but just for consistency
since they are represented as Constant nodes, we'll mirror