Interned strings are immortal, despite what the documentation says · Issue #113993 · python/cpython · GitHub

github.com

Tin mới

GitHub CopilotWrite better code with AI

GitHub Copilot appDirect agents from issue to merge

ActionsAutomate any workflow

CodespacesInstant dev environments

IssuesPlan and track work

Code ReviewManage code changes

Code QualityEnforce quality at merge

GitHub Advanced SecurityFind and fix vulnerabilities

Code securitySecure your code as you build

Secret protectionStop leaks before they start

View all use cases

Financial services

View all industries

Software Development

GitHub SponsorsFund open source developers

Copilot for BusinessEnterprise-grade AI features

Premium SupportEnterprise-grade 24/7 support

Pull requests 2.6k

Security and quality 0

topic-subinterpreters

type-bugAn unexpected behavior, bug, or error

interns every path segment it processes

Interned strings are not immortal; you must keep a reference to the return value of intern() around to benefit from it.

gh-113993: Allow interned strings to be mortal, and fix related issues #120520

[3.13] gh-113993: Allow interned strings to be mortal, and fix related issues (GH-120520) #120945

gh-113993: For string interning, do not rely on (or assert) _Py_IsImmortal #121358

gh-113993: Don't immortalize in PyUnicode_InternInPlace; keep immortalizing in other API #121364

[3.13] gh-113993: For string interning, do not rely on (or assert) _Py_IsImmortal (GH-121358) #121851

[3.13] gh-113993: Don't immortalize in PyUnicode_InternInPlace; keep immortalizing in other API (GH-121364) #121854

[3.12] gh-113993: Make interned strings mortal (GH-120520, GH-121364, GH-121903, GH-122303) #123065

[3.12] gh-113993: For string interning, do not rely on (or assert) _Py_IsImmortal (GH-121358) (GH-121851) #124938

gh-113993: InternalDocs: Add String Interning to README #127250

gh-121863: Immortalize names in code objects to avoid crash #121903

gh-122291: Intern latin-1 one-byte strings at startup #122303

gh-122420: Fix accounting for immortal interned strings in refleak.py #122421