I need to test whether the string is interned for Python implementations of marshal.dumps(). It is easy to do in C, and I suggest to expose this functionality to Python.
Currently you can test if the string is interned using the following function:
defisinterned(s):
returnsys.intern(s) iss
But it has a side effect -- it interns a string if it is not equal to an already interned string.
Activity
serhiy-storchaka commented on Aug 13, 2018
I need to test whether the string is interned for Python implementations of marshal.dumps(). It is easy to do in C, and I suggest to expose this functionality to Python.
Currently you can test if the string is interned using the following function:
But it has a side effect -- it interns a string if it is not equal to an already interned string.
tiran commented on Aug 13, 2018
I'd prefer to have this as an internal API, either sys._isinterned() or as a helper method in testcapi.
brettcannon commented on Aug 14, 2018
I agree with Christian; this is an implementation detail so it should be flagged as private/internal somehow.
warsaw commented on Aug 15, 2018
Agreed it should be non-public, but can we please call it sys._is_interned()?
serhiy-storchaka commented on Aug 19, 2018
Thank you all for the feedback. The function is renamed to sys._is_interned() and documented as optional.