htmlescape: inconsistency between _py_htmltext and _c_htmltext

Graham Fawcett <[email protected]>
Newsgroups gmane.comp.web.quixote.user
Message-ID <[email protected]>
There's an inconsistency between the definitions of htmlescape() in the 
Python and C versions. The Python version uses "isinstance(s, htmltext)" 
to test for htmltext instances. The C version uses "((v)->ob_type == 
&htmltext_Type)" which mirrors the old "classof(s) is htmltext" 
behaviour. Thus, the C implementation does not recognize subclasses of 
htmltext.

To allow for htmltext subclasses to work as expected, could 
_c_htmltext.c be modified so that:

#define htmltextObject_Check(v)    ((v)->ob_type == &htmltext_Type)

is replaced with

#define htmltextObject_Check(v)    (PyType_IsSubtype((v)->ob_type, 
&htmltext_Type))

Thanks,
Graham
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.