[issue27364] Deprecate invalid escape sequences in str/bytes

2018-02-22 Thread Emanuel Barry

Emanuel Barry  added the comment:

I have created Issue32912 as a follow-up to this issue for 3.8.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27364] Deprecate invalid escape sequences in str/bytes

2017-07-11 Thread R. David Murray

R. David Murray added the comment:

Also note that we have fixed a number of bugs in the stdlib code where a raw 
string was not used for a docstring when it should have been.  And when I say 
bugs, I mean both formatting problems in pydoc, and doctest bugs.  There may 
even have been a case where it produced a code bug, but I'm not sure I'm 
recalling that correctly :)

So yes, requiring that a docstring containing backslashes be marked as a raw 
string is very intentional.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27364] Deprecate invalid escape sequences in str/bytes

2017-07-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Yes, this was the intention. One of often errors is using "\n" in non-raw 
docstrings. This change doesn't prevent this error, but increases chances of 
catching it when there are other backslashes in the docstring.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27364] Deprecate invalid escape sequences in str/bytes

2017-07-10 Thread Guido van Rossum

Guido van Rossum added the comment:

Yes.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27364] Deprecate invalid escape sequences in str/bytes

2017-07-10 Thread Jason R. Coombs

Jason R. Coombs added the comment:

One consequence of this change is that now any string that has a backslash 
needs to be escaped or raw, leading to changes like this on 
(https://github.com/cherrypy/cherrypy/pull/1610/commits/1d8c03ea8c5fe90f29bbea267300b97c78391c24#diff-be33a4f55d59dfc70fc6452482f3a7a4)
 where the diagram in the docstring is the culprit. An escaped backslash is not 
viable in this case, so a raw string is required.

This particular example strikes me as counter-intuitive, though maybe I just 
need to adjust my intuition.

Was the intention for a docstring like above to use raw strings?

--
nosy: +jason.coombs

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27364] Deprecate invalid escape sequences in str/bytes

2016-09-13 Thread Chi Hsuan Yen

Chi Hsuan Yen added the comment:

Opened a new issue at Issue28128.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27364] Deprecate invalid escape sequences in str/bytes

2016-09-12 Thread Emanuel Barry

Emanuel Barry added the comment:

Fair enough, but please open a new issue for that.

@Terry - you're welcome; that's exactly the reason I pushed for it :)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27364] Deprecate invalid escape sequences in str/bytes

2016-09-11 Thread Emanuel Barry

Emanuel Barry added the comment:

Fair enough; I can see why such an addition would be a good idea. But please 
open a new issue for that (add me to nosy); I don't want this issue to be 
further cluttered.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27364] Deprecate invalid escape sequences in str/bytes

2016-09-11 Thread Chi Hsuan Yen

Chi Hsuan Yen added the comment:

Currently the deprecation message is not so useful when fixing lots of files in 
a large project. For example, I have two files foo.py and bar.py:

# foo.py
import bar

# bar.py
print('\d')

It gives:
$ python3.6 -W error foo.py
Traceback (most recent call last):
  File "foo.py", line 1, in 
import bar
DeprecationWarning: invalid escape sequence '\d'

Things are worse when __import__, imp or importlib are involved. I have to add 
some codes to show which module is imported.

It would be better to have at least filenames and line numbers:
$ ./python -W error foo.py
Traceback (most recent call last):
  File "foo.py", line 1, in 
import bar
  File "/home/yen/Projects/cpython/build/bar.py", line 1
print('\d')
 ^
SyntaxError: (deprecated usage) invalid escape sequence '\d'

I have a naive try that prints more information. Raising SyntaxError may not be 
a good idea, anyway.

--
nosy: +Chi Hsuan Yen
Added file: http://bugs.python.org/file44550/verbose-deprecation.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27364] Deprecate invalid escape sequences in str/bytes

2016-09-09 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 98a57845c8cc by Martin Panter in branch 'default':
Issue #27364: Raw strings to avoid deprecated escaping in com2ann.py
https://hg.python.org/cpython/rev/98a57845c8cc

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27364] Deprecate invalid escape sequences in str/bytes

2016-09-08 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 60085c8f01fe by R David Murray in branch 'default':
#27364: Credit Emanuel Barry in NEWS item.
https://hg.python.org/cpython/rev/60085c8f01fe

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27364] Deprecate invalid escape sequences in str/bytes

2016-09-08 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Thank you all for persisting on this.  I have seen numerous beginners be 
puzzled why normal (cooked) strings using '\' for Windows paths sometimes work 
and sometimes 'mysteriously' do not, as in the initially referenced issue.  I 
also think it better to consistently use 'r' for REs with '\' intended to be 
passed through to re.  (And I pushed some of the IDLE code that was patched.)

--
nosy: +terry.reedy

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27364] Deprecate invalid escape sequences in str/bytes

2016-09-08 Thread R. David Murray

R. David Murray added the comment:

Thanks Emanuel.  No bets on how much hate mail we get for this :)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27364] Deprecate invalid escape sequences in str/bytes

2016-09-08 Thread Emanuel Barry

Emanuel Barry added the comment:

Thank you David for taking the time to review and commit this :)

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27364] Deprecate invalid escape sequences in str/bytes

2016-09-08 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 38802c38cfe1 by R David Murray in branch 'default':
#27364: Deprecate invalid escape strings in str/byutes.
https://hg.python.org/cpython/rev/38802c38cfe1

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27364] Deprecate invalid escape sequences in str/bytes

2016-09-08 Thread R. David Murray

R. David Murray added the comment:

Here's a copy of Emanuel's deprecation patch with a versionchanged note in the 
lexical docs and a whatsnew entry.

--
Added file: 
http://bugs.python.org/file44475/deprecate_invalid_escapes_both_5.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27364] Deprecate invalid escape sequences in str/bytes

2016-09-08 Thread Roundup Robot

Roundup Robot added the comment:

New changeset b4cc62473c13 by R David Murray in branch 'default':
#27364: fix "incorrect" uses of escape character in the stdlib.
https://hg.python.org/cpython/rev/b4cc62473c13

--
nosy: +python-dev

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27364] Deprecate invalid escape sequences in str/bytes

2016-09-08 Thread Emanuel Barry

Emanuel Barry added the comment:

All right, since you'll work on it I'm leaving it out. Removed it and 
test_bytes (which you already fixed, thanks!) from new patch.

--
Added file: http://bugs.python.org/file44465/invalid_stdlib_escapes_5.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27364] Deprecate invalid escape sequences in str/bytes

2016-09-08 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I suggest to not change fixcid.py. It is not correct and there is special issue 
for this (issue27952).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27364] Deprecate invalid escape sequences in str/bytes

2016-09-08 Thread Emanuel Barry

Emanuel Barry added the comment:

Thank you R. David for the review, here's a new patch with the one change.

--
Added file: http://bugs.python.org/file44463/invalid_stdlib_escapes_4.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27364] Deprecate invalid escape sequences in str/bytes

2016-09-07 Thread Emanuel Barry

Changes by Emanuel Barry :


Added file: 
http://bugs.python.org/file44457/invalid_stdlib_escapes_3_rebased_2.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27364] Deprecate invalid escape sequences in str/bytes

2016-09-07 Thread Guido van Rossum

Guido van Rossum added the comment:

+1 on getting this in. Who can help reviewing and merging before beta 1?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27364] Deprecate invalid escape sequences in str/bytes

2016-09-07 Thread Emanuel Barry

Changes by Emanuel Barry :


Added file: http://bugs.python.org/file44435/invalid_stdlib_escapes_4.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27364] Deprecate invalid escape sequences in str/bytes

2016-09-07 Thread Emanuel Barry

Changes by Emanuel Barry :


Removed file: 
http://bugs.python.org/file44433/invalid_stdlib_escapes_3_regen.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27364] Deprecate invalid escape sequences in str/bytes

2016-09-07 Thread Emanuel Barry

Changes by Emanuel Barry :


Added file: 
http://bugs.python.org/file44433/invalid_stdlib_escapes_3_regen.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27364] Deprecate invalid escape sequences in str/bytes

2016-09-07 Thread Emanuel Barry

Emanuel Barry added the comment:

Rebased patch after Victor's commit in #16334. Also regenerated 
invalid_stdlib_escapes_3 in the hopes that Rietveld picks it up.

--
Added file: 
http://bugs.python.org/file44432/deprecate_invalid_escapes_both_4.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27364] Deprecate invalid escape sequences in str/bytes

2016-09-05 Thread Emanuel Barry

Emanuel Barry added the comment:

Updated and rebased patch. There's a few file tweaks here and there to stay up 
to date, otherwise it's mostly the same.

Martin, it may look like I've ignored your comments, but I'm trying to keep the 
patches as simple as possible, and so I don't want to go further than to make 
strings into raw strings (also the alignment issue you pointed out). I'd rather 
have the other issues addressed in another issue, as I want to get this merged 
in time for the feature freeze. The other issues (some which were already 
present) can be taken care of during the beta phase.

--
title: Deprecate invalid unicode escape sequences -> Deprecate invalid escape 
sequences in str/bytes
Added file: http://bugs.python.org/file44382/invalid_stdlib_escapes_3.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com