Possible bug in sgmllib?

Fredrik Nehr frneh at yahoo.com
Thu Oct 5 08:07:15 EDT 2000


The start_<tag> and do_<tag> methods does't get called with the correct name
when tag contains a underscore, however the end_<tag> method works as
expected.

This interactive session shows the possible problem:

ActivePython 1.6, build 100 (ActiveState Tool Corp.)
based on Python 1.6b1 (#0, Aug 23 2000, 13:42:10) [MSC 32 bit (Intel)] on
win32
Copyright (c) Corporation for National Research Initiatives.
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam.
>>> import sgmllib
>>> class Parser(sgmllib.SGMLParser):
...     def __getattr__(self, name):
...             print name
...             raise AttributeError
...
>>> Parser().feed("<foo>data</foo>")
start_foo
do_foo
end_foo
>>> Parser().feed("<foo_bar>data</foo_bar>")
start_foo
do_foo
end_foo_bar
>>>



Regards,

Fredrik Nehr






More information about the Python-list mailing list