summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-06-23 22:10:40 (GMT)
committerGitHub <noreply@github.com>2020-06-23 22:10:40 (GMT)
commitf363d0a6e9cfa50677a6de203735fbc0d06c2f49 (patch)
tree9092c9d82a215dcfce789e4ad81ac2b4e8be2fed /Include
parentd051801052211b533c46a593b1c1bccf649a171c (diff)
downloadcpython-f363d0a6e9cfa50677a6de203735fbc0d06c2f49.zip
cpython-f363d0a6e9cfa50677a6de203735fbc0d06c2f49.tar.gz
cpython-f363d0a6e9cfa50677a6de203735fbc0d06c2f49.tar.bz2
bpo-40521: Make empty Unicode string per interpreter (GH-21096)
Each interpreter now has its own empty Unicode string singleton.
Diffstat (limited to 'Include')
-rw-r--r--Include/internal/pycore_interp.h2
-rw-r--r--Include/internal/pycore_pylifecycle.h2
2 files changed, 3 insertions, 1 deletions
diff --git a/Include/internal/pycore_interp.h b/Include/internal/pycore_interp.h
index 435a72a..d8947e7 100644
--- a/Include/internal/pycore_interp.h
+++ b/Include/internal/pycore_interp.h
@@ -71,6 +71,8 @@ struct _Py_bytes_state {
};
struct _Py_unicode_state {
+ // The empty Unicode object is a singleton to improve performance.
+ PyObject *empty;
struct _Py_unicode_fs_codec fs_codec;
};
diff --git a/Include/internal/pycore_pylifecycle.h b/Include/internal/pycore_pylifecycle.h
index cd47044..f29c7cb 100644
--- a/Include/internal/pycore_pylifecycle.h
+++ b/Include/internal/pycore_pylifecycle.h
@@ -31,7 +31,7 @@ PyAPI_FUNC(int) _Py_IsLocaleCoercionTarget(const char *ctype_loc);
/* Various one-time initializers */
-extern PyStatus _PyUnicode_Init(void);
+extern PyStatus _PyUnicode_Init(PyThreadState *tstate);
extern int _PyStructSequence_Init(void);
extern int _PyLong_Init(PyThreadState *tstate);
extern PyStatus _PyFaulthandler_Init(int enable);