mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
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.
This commit is contained in:
parent
0f8ec1fff0
commit
91698d8caa
5 changed files with 107 additions and 53 deletions
|
@ -32,6 +32,7 @@ PyAPI_FUNC(int) _Py_IsLocaleCoercionTarget(const char *ctype_loc);
|
|||
/* Various one-time initializers */
|
||||
|
||||
extern PyStatus _PyUnicode_Init(PyThreadState *tstate);
|
||||
extern PyStatus _PyBytes_Init(PyThreadState *tstate);
|
||||
extern int _PyStructSequence_Init(void);
|
||||
extern int _PyLong_Init(PyThreadState *tstate);
|
||||
extern PyStatus _PyTuple_Init(PyThreadState *tstate);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue