Issue 34392: Add sys.isinterned() - Python tracker
Created on 2018-08-13 10:24 by serhiy.storchaka, last changed 2022-04-11 14:59 by admin.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 8755 | open | serhiy.storchaka, 2018-08-13 10:29 | |
| Messages (5) | |||
|---|---|---|---|
| msg323473 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * ![]() |
Date: 2018-08-13 10:24 | |
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:
def isinterned(s):
return sys.intern(s) is s
But it has a side effect -- it interns a string if it is not equal to an already interned string.
|
|||
| msg323474 - (view) | Author: Christian Heimes (christian.heimes) * ![]() |
Date: 2018-08-13 11:07 | |
I'd prefer to have this as an internal API, either sys._isinterned() or as a helper method in testcapi. |
|||
| msg323539 - (view) | Author: Brett Cannon (brett.cannon) * ![]() |
Date: 2018-08-14 20:43 | |
I agree with Christian; this is an implementation detail so it should be flagged as private/internal somehow. |
|||
| msg323545 - (view) | Author: Barry A. Warsaw (barry) * ![]() |
Date: 2018-08-15 00:13 | |
Agreed it should be non-public, but can we please call it sys._is_interned()? |
|||
| msg323744 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * ![]() |
Date: 2018-08-19 06:55 | |
Thank you all for the feedback. The function is renamed to sys._is_interned() and documented as optional. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:59:04 | admin | set | github: 78573 |
| 2022-02-09 05:52:10 | methane | link | issue46688 superseder |
| 2018-08-19 06:55:15 | serhiy.storchaka | set | messages: + msg323744 |
| 2018-08-15 00:13:57 | barry | set | nosy:
+ barry messages: + msg323545 |
| 2018-08-14 20:43:28 | brett.cannon | set | nosy:
+ brett.cannon messages: + msg323539 |
| 2018-08-13 11:07:02 | christian.heimes | set | nosy:
+ christian.heimes messages: + msg323474 |
| 2018-08-13 10:29:27 | serhiy.storchaka | set | keywords:
+ patch stage: patch review pull_requests: + pull_request8231 |
| 2018-08-13 10:24:33 | serhiy.storchaka | create | |
