This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: html.escape docstring does not mention single quotes (')
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.2
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: ezio.melotti, orsenthil, python-dev, sandro.tosi, zvin
Priority: normal Keywords:

Created on 2011-09-08 19:00 by zvin, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (6)
msg143736 - (view) Author: zvin (zvin) Date: 2011-09-08 19:00
The html.escape docstring says:

"""
Replace special characters "&", "<" and ">" to HTML-safe sequences.
If the optional flag quote is true (the default), the quotation mark
character (") is also translated.
"""

But if you set the optional flag quote to True, this function also escapes single quotes ('). You can see it by comparing _escape_map and _escape_map_full. [http://hg.python.org/cpython/file/cf811943046b/Lib/html/__init__.py]
The docstring needs to be updated.
msg143737 - (view) Author: zvin (zvin) Date: 2011-09-08 19:51
Or maybe instead of updating the docstring, we should remove the single quote (') from _escape_map_full.

cgi.escape did not escaped the single quotes (') and if you use it now, it says: 
"PendingDeprecationWarning: cgi.escape is deprecated, use html.escape instead"
msg143943 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2011-09-12 23:01
Yes, single quotes should not escaped in the CGI escape. We should remove that from the table.
msg143944 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2011-09-12 23:07
The single quote escape was added due to Issue9061 and Issue2830. Since it was included deliberately due to above raised issues, it is best to document it, instead of removing it.
msg143945 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2011-09-12 23:15
New changeset bc5b96c92770 by Senthil Kumaran in branch '3.2':
Fix issue12938 - Update the docstring of html.escape. Include the information on single quote.
http://hg.python.org/cpython/rev/bc5b96c92770
msg144243 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2011-09-18 14:10
This is fixed in all revisions.
History
Date User Action Args
2022-04-11 14:57:21adminsetgithub: 57147
2011-09-18 14:10:59orsenthilsetstatus: open -> closed
resolution: fixed
messages: + msg144243

stage: resolved
2011-09-12 23:15:00python-devsetnosy: + python-dev
messages: + msg143945
2011-09-12 23:07:18orsenthilsetmessages: + msg143944
2011-09-12 23:01:12orsenthilsetnosy: + orsenthil
messages: + msg143943
2011-09-08 19:51:40zvinsetmessages: + msg143737
2011-09-08 19:22:48zvinsettitle: html.escape does not mention single quotes (') -> html.escape docstring does not mention single quotes (')
2011-09-08 19:02:42ezio.melottisetnosy: + ezio.melotti, sandro.tosi
2011-09-08 19:00:20zvincreate