[issue10935] wsgiref.handlers.BaseHandler and subclasses of str
Antoine Pitrou
report at bugs.python.org
Thu Jan 20 20:31:11 CET 2011
Antoine Pitrou <pitrou at free.fr> added the comment:
> PyString_AsString() only "works on subclasses" if their internal
> representation is the same as type str. So we can't say "subclass of
> str" without *also* specifying that the subclass store its contents in
> exactly the same way as an object of type str...
There's no point in subclassing str if you're using a different
representation. You're not only wasting space, but some things will
behave badly (precisely because of lot of C functions will call
PyString_Check() and then PyString_AsString()).
So, what you call a limitation isn't really one.
> which means all we've really done is to make the specification longer
> and more complicated
That doesn't follow from the above.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10935>
_______________________________________
More information about the Python-bugs-list
mailing list