bpo-40521: Make Unicode latin1 singletons per interpreter (GH-21101)

Each interpreter now has its own Unicode latin1 singletons.

Remove "ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS"
and "ifdef LATIN1_SINGLETONS": always enable latin1 singletons.

Optimize unicode_result_ready(): only attempt to get a latin1
singleton for PyUnicode_1BYTE_KIND.
This commit is contained in:
Victor Stinner 2020-06-24 02:22:21 +02:00 committed by GitHub
parent bbf36e8903
commit 2f9ada96e0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 36 additions and 43 deletions

View file

@ -73,6 +73,9 @@ struct _Py_bytes_state {
struct _Py_unicode_state {
// The empty Unicode object is a singleton to improve performance.
PyObject *empty;
/* Single character Unicode strings in the Latin-1 range are being
shared as well. */
PyObject *latin1[256];
struct _Py_unicode_fs_codec fs_codec;
};