classification
Title: module html.parser HTMLParser's strict mode don't work
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.2
process
Status: closed Resolution: duplicate
Dependencies: Superseder:
Assigned To: Nosy List: ezio.melotti, pysean
Priority: normal Keywords:

Created on 2013-01-14 12:54 by pysean, last changed 2013-01-14 13:02 by ezio.melotti. This issue is now closed.

Messages (3)
msg179938 - (view) Author: sean (pysean) Date: 2013-01-14 12:54
NOTE: SAME AS Python 3.2.2, Python 3.3 from python.org/download

Python 3.2.2 Stackless 3.1b3 060516 (default, Feb 20 2012, 13:36:12) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> from html.parser import HTMLParser
>>> class LooseParser(HTMLParser):
	def __init__(self, strict=False):
		HTMLParser.__init__(self, strict=strict)
	def handle_starttag(self, tag, attrs):
		print('Tag:', tag)

		
>>> p = LooseParser()
>>> p.feed('<p>hello</p>')
>>>
msg179939 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2013-01-14 13:00
It works for me on 3.2.3, 3.2.3+, 3.3.0+, 3.4.0a0
>>> from html.parser import HTMLParser
>>> class LooseParser(HTMLParser):
...     def __init__(self, strict=False):
...             HTMLParser.__init__(self, strict=strict)
...     def handle_starttag(self, tag, attrs):
...             print('Tag:', tag)
... 
>>> p = LooseParser()
>>> p.feed('<p>hello</p>')
Tag: p
>>>
msg179940 - (view) Author: sean (pysean) Date: 2013-01-14 13:01
SAME AS
 #issue13273
http://bugs.python.org/issue13273
History
Date User Action Args
2013-01-14 13:02:59ezio.melottisetstage: resolved
2013-01-14 13:01:49pyseansetstatus: open -> closed
resolution: duplicate
messages: + msg179940
2013-01-14 13:00:02ezio.melottisetnosy: + ezio.melotti
messages: + msg179939
2013-01-14 12:54:15pyseancreate