[issue29276] HTMLParser in Python 2.7 doesn't recognize image tags wrapped up in link tags

2017-01-14 Thread Ari
New submission from Ari: The following code produces incorrect results under Python 2.7.13. One would expect it to print 2 lines, "Encountered a start tag: a" and "Encountered a start tag: img". Yet it prints only "Encountered a start tag: a". from HTMLParser import HTMLParser class MyHTMLPars

[issue29276] HTMLParser in Python 2.7 doesn't recognize image tags wrapped up in link tags

2017-01-14 Thread Xiang Zhang
Xiang Zhang added the comment: I can get the expected behaviour with the lastest 2.7 build. Python 2.7.13+ (2.7:0d4e0a736688, Jan 15 2017, 00:51:57) [GCC 5.2.1 20151010] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from HTMLParser import HTMLParser >>> cl

[issue29276] HTMLParser in Python 2.7 doesn't recognize image tags wrapped up in link tags

2017-01-14 Thread Brendan Donegan
Brendan Donegan added the comment: I even get the correct behaviour in 2.7.12: Python 2.7.12+ (default, Sep 17 2016, 12:08:02) [GCC 6.2.0 20160914] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from HTMLParser import HTMLParser >>> class MyHTMLParser(HTMLPa

[issue29276] HTMLParser in Python 2.7 doesn't recognize image tags wrapped up in link tags

2017-01-14 Thread Ari
Ari added the comment: Sorry, it was a false alarm. I had a poorly constructed testcase. I was trying to grab all image links from html markup while simultaneously substituting image links to somesite.com with links to anothersite.com. I had handle_starttag and handle_startendtag defined in my