Ref Count Checking

Robin Becker robin at
Thu Aug 30 12:05:38 CEST 2001

In article <4325613.PTg5d078U9 at>, Markus Schaber <markus at> writes
>As Strings are unique, and internalized, may be the module as such 
>(compiled code) contains references to the strings?
well I don't have to do that in my extension and things seem to work fine with the external
results. Perhaps I'm being naive when I do

PyDict_SetItemString(attrs, name, t=PyString_FromString(sValue));

ie I haven't interned anything.

Would the module need two extra refs as in

>>> from sys import getrefcount as rc
>>> p={'az1': 99999}
>>> q={'az2': 'az3'}
>>> rc(p['az1']), rc(q['az2'])
(2, 4)
Robin Becker

More information about the Python-list mailing list