mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
Add interning of unicode strings by copying the functionality from
stringobject.c. Intern "True" and "False" in bool_repr() again as it was in the 8bit string era.
This commit is contained in:
parent
34a042d301
commit
1680713e52
5 changed files with 158 additions and 7 deletions
|
|
@ -24,10 +24,10 @@ bool_repr(PyObject *self)
|
|||
|
||||
if (self == Py_True)
|
||||
s = true_str ? true_str :
|
||||
(true_str = PyUnicode_FromString("True"));
|
||||
(true_str = PyUnicode_InternFromString("True"));
|
||||
else
|
||||
s = false_str ? false_str :
|
||||
(false_str = PyUnicode_FromString("False"));
|
||||
(false_str = PyUnicode_InternFromString("False"));
|
||||
Py_XINCREF(s);
|
||||
return s;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue