]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-40521: Optimize PyBytes_FromStringAndSize(str, 0) (GH-21142)
authorVictor Stinner <vstinner@python.org>
Thu, 25 Jun 2020 12:07:40 +0000 (14:07 +0200)
committerGitHub <noreply@github.com>
Thu, 25 Jun 2020 12:07:40 +0000 (14:07 +0200)
commit91698d8caa4b5bb6e8dbb64b156e8afe9e32cac1
treeafe2af94e5cf72cc28d405ae2c30dcb2210e52ea
parent0f8ec1fff01173803645ad6a8aea24997bf66fc1
bpo-40521: Optimize PyBytes_FromStringAndSize(str, 0) (GH-21142)

Always create the empty bytes string singleton.

Optimize PyBytes_FromStringAndSize(str, 0): it no longer has to check
if the empty string singleton was created or not, it is always
available.

Add functions:

* _PyBytes_Init()
* bytes_get_empty(), bytes_new_empty()
* bytes_create_empty_string_singleton()
* unicode_create_empty_string_singleton()

_Py_unicode_state: rename empty structure member to empty_string.
Include/internal/pycore_interp.h
Include/internal/pycore_pylifecycle.h
Objects/bytesobject.c
Objects/unicodeobject.c
Python/pylifecycle.c