Message40465
Logged In: YES
user_id=21627
Some mutually unrelated comments:
- the GC_UnTrack call for interned is not need: GC won't be
able to explain the reference that stringobject.c holds.
- why does this try to "fix" the problem of dangling
interned strings? AFAICT: if there is a reference to an
interned string at the time _Py_ReleaseInternedStrings is
called, that reference is silently dropped, and a later
DECREF will result in memory corruption. IOW: it should
merely set the state of all strings to normal, and clear the
dict.
- Replacing PyString_InternInPlace with PyString_Intern
seems dangerous. AFAICT, the fragment
PyString_InternInPlace(&name);
Py_DECREF(name);
return PyString_AS_STRING(name);
from getclassname would break: Intern() would return the
only reference to the interned string (assuming this is the
first usage), and getclassname drops this reference,
returning a pointer to deallocated memory. I'm not sure
though why getclassname interns the result in the first place.
Selectively replacing them might be a good idea, though. For
intern(), I think an optional argument strongref needs to be
provided (the interned dict essentially weak-references the
strings). Perhaps the default even needs to be weakref. |
|
Date |
User |
Action |
Args |
2007-08-23 15:13:56 | admin | link | issue576101 messages |
2007-08-23 15:13:56 | admin | create | |
|