[Python-Dev] d.get_key(key) -> key?

Greg Ewing greg@cosc.canterbury.ac.nz
Fri, 07 Jun 2002 13:02:56 +1200 (NZST)


Guido:

> It's also quite possible that there are no outside
> references to an interned string, but another string with the same
> value still references the interned string from its ob_sinterned
> field.
> 
> To solve this, we would have to make the ob_sinterned slot count as a
> reference to the interned string.  But then string_dealloc would be
> complicated (it would have to call Py_XDECREF(op->ob_sinterned)),
> possibly slowing things down.

If the intern table cleanup is being done by a GC pass, you
don't need a full Py_XDECREF -- you only need to decrement
op->ob_sinterned->ob_refcnt. Doesn't sound excessively
expensive to me, but I suppose it would have to be timed
to make sure.

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg@cosc.canterbury.ac.nz	   +--------------------------------------+