[Python-checkins] r47081 - in python/branches/release24-maint/Lib: sgmllib.py test/test_sgmllib.py

fred.drake python-checkins at python.org
Fri Jun 23 08:12:32 CEST 2006


Author: fred.drake
Date: Fri Jun 23 08:12:31 2006
New Revision: 47081

Modified:
   python/branches/release24-maint/Lib/sgmllib.py
   python/branches/release24-maint/Lib/test/test_sgmllib.py
Log:
- SF bug #853506: IP6 address parsing in sgmllib
  ('[' and ']' were not accepted in unquoted attribute values)


Modified: python/branches/release24-maint/Lib/sgmllib.py
==============================================================================
--- python/branches/release24-maint/Lib/sgmllib.py	(original)
+++ python/branches/release24-maint/Lib/sgmllib.py	Fri Jun 23 08:12:31 2006
@@ -33,7 +33,7 @@
 tagfind = re.compile('[a-zA-Z][-_.a-zA-Z0-9]*')
 attrfind = re.compile(
     r'\s*([a-zA-Z_][-:.a-zA-Z_0-9]*)(\s*=\s*'
-    r'(\'[^\']*\'|"[^"]*"|[-a-zA-Z0-9./,:;+*%?!&$\(\)_#=~\'"@]*))?')
+    r'(\'[^\']*\'|"[^"]*"|[][\-a-zA-Z0-9./,:;+*%?!&$\(\)_#=~\'"@]*))?')
 
 
 class SGMLParseError(RuntimeError):

Modified: python/branches/release24-maint/Lib/test/test_sgmllib.py
==============================================================================
--- python/branches/release24-maint/Lib/test/test_sgmllib.py	(original)
+++ python/branches/release24-maint/Lib/test/test_sgmllib.py	Fri Jun 23 08:12:31 2006
@@ -219,6 +219,14 @@
             ("starttag", "a", [("a.b", "v"), ("c:d", "v"), ("e-f", "v")]),
             ])
 
+    def test_attr_value_ip6_url(self):
+        # http://www.python.org/sf/853506
+        self.check_events(("<a href='http://[1080::8:800:200C:417A]/'>"
+                           "<a href=http://[1080::8:800:200C:417A]/>"), [
+            ("starttag", "a", [("href", "http://[1080::8:800:200C:417A]/")]),
+            ("starttag", "a", [("href", "http://[1080::8:800:200C:417A]/")]),
+            ])
+
     def test_illegal_declarations(self):
         s = 'abc<!spacer type="block" height="25">def'
         self.check_events(s, [


More information about the Python-checkins mailing list