2 ms·
You're right, PyUnicode_InternInPlace (which is called by sys.intern) already caches results using a regular Python dictionary, so @functools.cache wouldn't add
by ciupicri 5y ago
You're right, PyUnicode_InternInPlace (which is called by sys.intern) already caches results using a regular Python dictionary, so @functools.cache wouldn't add any value.
It happened a long time ago, but I think I misread something about sys.intern not being able to handle lots and lots of strings, so I added an extra layer of caching, but it looks like it's not needed anymore.
[1]: https://github.com/python/cpython/blob/3.10/Objects/unicodeobject.c#L15794 https://github.com/python/cpython/blob/3.10/Objects/unicodeo...