15 Jun
2006
15 Jun
'06
2:13 p.m.
As an exercise in using the new set C API, I've replaced the "interned" dictionary in stringobject.c with a set. Surprisingly, what I thought would be a simple exercise, took several hours to implement and debug. Two problems are worth mentioning: 1. I had to add a function to setobject.h to retrieve a pointer to an object stored in a set. I could not find a way to do it using current API (short of iterating through the set of course). 2. I had to change the PyString_Fini() and PySet_Fini() in Py_Finalize() because cleaning "interned" set cannot be done after the set module is finalized. If there is any interest, I will submit a patch, but it does not seem to affect performance in any meaningful way.