[issue7615] unicode_escape codec does not escape quotes

2021-08-09 Thread Irit Katriel
Change by Irit Katriel : -- resolution: out of date -> versions: +Python 3.10, Python 3.11, Python 3.9 -Python 2.6, Python 2.7 ___ Python tracker ___ __

[issue7615] unicode_escape codec does not escape quotes

2021-08-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Nothing was changed. Backslashes in your output are backslashes in the bytes object repr. >>> print('a\'b"c\'\'\'d"""e'.encode('unicode_escape').decode()) a'b"c'''d"""e -- nosy: +serhiy.storchaka status: pending -> open ___

[issue7615] unicode_escape codec does not escape quotes

2021-08-09 Thread Irit Katriel
Irit Katriel added the comment: Looks like this has been fixed by now: >>> print(u'a\'b"c\'\'\'d"""e'.encode('unicode_escape')) b'a\'b"c\'\'\'d"""e' Let me know if there is a reason not to close this issue. -- nosy: +iritkatriel resolution: -> out of date status: open -> pending __

[issue7615] unicode_escape codec does not escape quotes

2014-02-03 Thread Mark Lawrence
Changes by Mark Lawrence : -- nosy: -BreamoreBoy ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.p

[issue7615] unicode_escape codec does not escape quotes

2010-07-28 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: Mark Lawrence wrote: > > Mark Lawrence added the comment: > > Could we please have some responses to msg98327 as there are some very > positive comments there. A patch implementing the suggestions would be even better :-) -- __

[issue7615] unicode_escape codec does not escape quotes

2010-07-28 Thread Mark Lawrence
Mark Lawrence added the comment: Could we please have some responses to msg98327 as there are some very positive comments there. -- nosy: +BreamoreBoy ___ Python tracker ___ ___

[issue7615] unicode_escape codec does not escape quotes

2010-01-26 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: Amaury Forgeot d'Arc wrote: > I feel uneasy to change the default unicode-escape encoding. > I think that we mix two features here; to transfer a unicode string between > two points, programs must agree on where the data ends, and how characters > are repr

[issue7615] unicode_escape codec does not escape quotes

2010-01-25 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc added the comment: I feel uneasy to change the default unicode-escape encoding. I think that we mix two features here; to transfer a unicode string between two points, programs must agree on where the data ends, and how characters are represented as bytes. All codecs inclu

[issue7615] unicode_escape codec does not escape quotes

2010-01-25 Thread Florent Xicluna
Changes by Florent Xicluna : -- nosy: +flox ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.o

[issue7615] unicode_escape codec does not escape quotes

2010-01-25 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: Richard Hansen wrote: > > Richard Hansen added the comment: > > Any comments on the patches? I'd love to see at least patches 1-3 make it > into Python 2.7. :) Sorry, I haven't had a chance to review them yet. Will try today. --

[issue7615] unicode_escape codec does not escape quotes

2010-01-24 Thread Richard Hansen
Richard Hansen added the comment: Any comments on the patches? I'd love to see at least patches 1-3 make it into Python 2.7. :) -- ___ Python tracker ___ _

[issue7615] unicode_escape codec does not escape quotes

2010-01-09 Thread Richard Hansen
Richard Hansen added the comment: Attaching a patch that eliminates duplicate code: * Merge unicodeescape_string(), PyUnicode_EncodeRawUnicodeEscape(), and modified_EncodeRawUnicodeEscape() into one function called _PyUnicode_EncodeCustomUnicodeEscape(). This patch is meant to be applied af

[issue7615] unicode_escape codec does not escape quotes

2010-01-09 Thread Richard Hansen
Richard Hansen added the comment: Attaching a patch for another issue discovered while looking at the code: * The Unicode escape encoders now check to make sure that the provided size is nonnegative. * C API documentation updated to make it clear that size must be nonnegative. This patch i

[issue7615] unicode_escape codec does not escape quotes

2010-01-09 Thread Richard Hansen
Richard Hansen added the comment: Attaching a patch for an issue discovered while looking at the code: * The UTF-16 decode logic in the Unicode escape encoders no longer reads past the end of the provided Py_UNICODE buffer if the last character's value is between 0xD800 and 0xDC00. This pat

[issue7615] unicode_escape codec does not escape quotes

2010-01-09 Thread Richard Hansen
Richard Hansen added the comment: Attaching a minimal patch: * unicode_escape now backslash-escapes single and double quotes * raw_unicode_escape now unicode-escapes single and double quotes * raw_unicode_escape now unicode-escapes backslashes * removes pickle's escaping workarounds so t

[issue7615] unicode_escape codec does not escape quotes

2010-01-09 Thread Richard Hansen
Richard Hansen added the comment: Attaching updated unit tests. The tests now check to make sure that single and double quotes are escaped. -- Added file: http://bugs.python.org/file15809/unicode_escape_tests.patch ___ Python tracker

[issue7615] unicode_escape codec does not escape quotes

2010-01-09 Thread Richard Hansen
Changes by Richard Hansen : Removed file: http://bugs.python.org/file15775/raw_unicode_escape_tests.patch ___ Python tracker ___ ___ Python-bug

[issue7615] unicode_escape codec does not escape quotes

2010-01-09 Thread Richard Hansen
Changes by Richard Hansen : Removed file: http://bugs.python.org/file15774/unicode_escape_tests.patch ___ Python tracker ___ ___ Python-bugs-li

[issue7615] unicode_escape codec does not escape quotes

2010-01-09 Thread Richard Hansen
Changes by Richard Hansen : Removed file: http://bugs.python.org/file15771/unicode_escape_reorg.patch ___ Python tracker ___ ___ Python-bugs-li

[issue7615] unicode_escape codec does not escape quotes

2010-01-09 Thread Richard Hansen
Changes by Richard Hansen : Removed file: http://bugs.python.org/file15729/unicode_escape_single_and_double_quotes.patch ___ Python tracker ___ __

[issue7615] unicode_escape codec does not escape quotes

2010-01-07 Thread Richard Hansen
Changes by Richard Hansen : Removed file: http://bugs.python.org/file15716/unicode_escape_single_quotes.patch ___ Python tracker ___ ___ Pytho

[issue7615] unicode_escape codec does not escape quotes

2010-01-07 Thread Richard Hansen
Richard Hansen added the comment: > We'll need a patch that implements single and double quote escaping > for unicode_escape and a \u style escaping of quotes for the > raw_unicode_escape encoder. OK, I'll remove unicode_escape_single_quotes.patch and update unicode_escape_reorg.patch.

[issue7615] unicode_escape codec does not escape quotes

2010-01-07 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: Richard Hansen wrote: > > Richard Hansen added the comment: > >> Does the last patch obsolete the first two? If so please delete the >> obsolete ones. > > Yes and no -- it depends on what the core Python developers want and are > comfortable with: >

[issue7615] unicode_escape codec does not escape quotes

2010-01-07 Thread Richard Hansen
Richard Hansen added the comment: Attaching updated unit tests for the raw_unicode_escape codec. -- Added file: http://bugs.python.org/file15775/raw_unicode_escape_tests.patch ___ Python tracker ___

[issue7615] unicode_escape codec does not escape quotes

2010-01-07 Thread Richard Hansen
Richard Hansen added the comment: Attaching updated unit tests for the unicode_escape codec. I removed the raw_unicode_escape tests and will attach a separate patch for those. -- Added file: http://bugs.python.org/file15774/unicode_escape_tests.patch _

[issue7615] unicode_escape codec does not escape quotes

2010-01-07 Thread Richard Hansen
Changes by Richard Hansen : Removed file: http://bugs.python.org/file15746/unicode_escape_tests.patch ___ Python tracker ___ ___ Python-bugs-li

[issue7615] unicode_escape codec does not escape quotes

2010-01-07 Thread Richard Hansen
Richard Hansen added the comment: > Does the last patch obsolete the first two? If so please delete the > obsolete ones. Yes and no -- it depends on what the core Python developers want and are comfortable with: * unicode_escape_single_quotes.patch: Only escapes single quotes, simple pat

[issue7615] unicode_escape codec does not escape quotes

2010-01-07 Thread R. David Murray
R. David Murray added the comment: Does the last patch obsolete the first two? If so please delete the obsolete ones. I imagine there are might be small doc updates required, as well. I haven't looked at the patch itself, but concerning your test patch: your try/except style is unnecessary

[issue7615] unicode_escape codec does not escape quotes

2010-01-07 Thread Richard Hansen
Richard Hansen added the comment: I believe this issue is ready to be bumped to the "patch review" stage. Thoughts? -- ___ Python tracker ___ __

[issue7615] unicode_escape codec does not escape quotes

2010-01-07 Thread Richard Hansen
Richard Hansen added the comment: Attaching updated unicode_escape_reorg.patch. This addresses two additional issues: * removes pickle's workaround of raw-unicode-escape's broken escaping * eliminates duplicated code (the raw escape encode function was copied with only a slight modificati

[issue7615] unicode_escape codec does not escape quotes

2010-01-07 Thread Richard Hansen
Changes by Richard Hansen : Removed file: http://bugs.python.org/file15748/unicode_escape_reorg.patch ___ Python tracker ___ ___ Python-bugs-li

[issue7615] unicode_escape codec does not escape quotes

2010-01-05 Thread Richard Hansen
Richard Hansen added the comment: Attaching updated unicode_escape_reorg.patch. This fixes two additional issues: * don't call _PyString_Resize() on an empty string because there is only one empty string instance, and that instance is returned when creating an empty string * make sure the

[issue7615] unicode_escape codec does not escape quotes

2010-01-05 Thread Richard Hansen
Changes by Richard Hansen : Removed file: http://bugs.python.org/file15742/unicode_escape_reorg.patch ___ Python tracker ___ ___ Python-bugs-li

[issue7615] unicode_escape codec does not escape quotes

2010-01-05 Thread Richard Hansen
Richard Hansen added the comment: Attached is a patch to the unicode unit tests. It adds tests for the following: * unicode_escape escapes single quotes * raw_unicode_escape escapes single quotes * raw_unicode_escape escapes backslashes -- Added file: http://bugs.python.org/file1

[issue7615] unicode_escape codec does not escape quotes

2010-01-04 Thread Richard Hansen
Richard Hansen added the comment: I thought about raw_unicode_escape more, and there's a way to escape quotes: use unicode escape sequences (e.g., ur'\u0027'). I've attached a new patch that does the following: * backslash-escapes single quotes when encoding with the unicode_escape codec

[issue7615] unicode_escape codec does not escape quotes

2010-01-03 Thread Richard Hansen
Richard Hansen added the comment: > If we change this, the encoder should quote both single and double > quotes - simply because it is not known whether the literal > will use single or double quotes. Or document that single quotes are always escaped so that the user knows he/she can safely

[issue7615] unicode_escape codec does not escape quotes

2010-01-02 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: Richard Hansen wrote: > > New submission from Richard Hansen : > > The description of the unicode_escape codec says that it produces "a > string that is suitable as Unicode literal in Python source code." [1] > Unfortunately, this is not true as it does n

[issue7615] unicode_escape codec does not escape quotes

2010-01-01 Thread Antoine Pitrou
Changes by Antoine Pitrou : -- nosy: +lemburg ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python

[issue7615] unicode_escape codec does not escape quotes

2009-12-31 Thread Ezio Melotti
Changes by Ezio Melotti : -- nosy: +ezio.melotti priority: -> normal stage: -> test needed ___ Python tracker ___ ___ Python-bugs-lis

[issue7615] unicode_escape codec does not escape quotes

2009-12-31 Thread Richard Hansen
New submission from Richard Hansen : The description of the unicode_escape codec says that it produces "a string that is suitable as Unicode literal in Python source code." [1] Unfortunately, this is not true as it does not escape quotes. For example: print u'a\'b"c\'\'\'d"""e'.encode('unico