[Python-ideas] Copy-on-write when forking a python process

Jim Jewett jimjjewett at gmail.com
Wed Apr 13 15:47:24 CEST 2011


On 4/13/11, Antoine Pitrou <solipsis at pitrou.net> wrote:
> On Tue, 12 Apr 2011 23:40:02 -0400
> Terry Reedy <tjreedy at udel.edu> wrote:

>> "Changed in version 2.3: Interned strings are not immortal (like they
>> used to be in Python 2.2 and before); you must keep a reference to the
>> return value of intern() around to benefit from it."

> That's a rather strange sentence, because interned strings *are*
> immortal (until the interpreter is shutdown).

The purpose of that change (which may no longer be effective; I
haven't checked recently) was that they were no longer immortal.  If
the last reference outside the intern dictionary was removed, then the
string was removed from the intern dictionary as well.  Intern was a
way to de-duplicate, but it didn't (by itself) make anything immortal.

-jJ



More information about the Python-ideas mailing list