pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/python/cpython/commit/f6de9eb2bb3c3c16694d582e3e1e2e9f56b97aab

-b69241e157469407.css" /> #19688: add back and deprecate the internal HTMLParser.unescape() met… · python/cpython@f6de9eb · GitHub
Skip to content

Commit f6de9eb

Browse files
committed
#19688: add back and deprecate the internal HTMLParser.unescape() method.
1 parent 32f0c7a commit f6de9eb

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

Lib/html/parser.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,3 +513,10 @@ def handle_pi(self, data):
513513
def unknown_decl(self, data):
514514
if self.strict:
515515
self.error("unknown declaration: %r" % (data,))
516+
517+
# Internal -- helper to remove special character quoting
518+
def unescape(self, s):
519+
warnings.warn('The unescape method is deprecated and will be removed '
520+
'in 3.5, use html.unescape() instead.',
521+
DeprecationWarning, stacklevel=2)
522+
return unescape(s)

Lib/test/test_htmlparser.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,13 @@ def test_EOF_in_charref(self):
569569
for html, expected in data:
570570
self._run_check(html, expected)
571571

572+
def test_unescape_method(self):
573+
from html import unescape
574+
p = self.get_collector()
575+
with self.assertWarns(DeprecationWarning):
576+
s = '"""&quot&#34&#x22&#bad;'
577+
self.assertEqual(p.unescape(s), unescape(s))
578+
572579
def test_broken_comments(self):
573580
html = ('<! not really a comment >'
574581
'<! not a comment either -->'

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy