Subclassing builtins or another alternative

Courageous jkraska at
Wed Dec 12 04:36:22 CET 2001

>So for the 2.2-and-later world, maybe Objects/stringobject.c
>has the solution.  (Wild guess: try adding Py_TPFLAGS_BASETYPE
>to your type's tp_flags.)

Good guess; that was one of the things I had to fix a bit
earlier. It's funny, I've written any number of Python
extensions, understand references, and so on, but I've
never quite had the problems I've had with this one before.

>Hope this helps!  Good luck!

Thanks! As it happens, I got it working, and inferred all
on my own that setattr isn't used in this context. It didn't
help that I introduced a typo to test code not shown that
forced an attribute to be used before it was set, temporarily
tricking me into thinking I hadn't solved the problem yet. :)

By the way, I _am_ using 2.2 (from CVS as a matter of fact).


More information about the Python-list mailing list