Invalid string escapes #2280

Closed
nascheme opened this Issue Dec 8, 2016 · 6 comments

Projects

None yet

3 participants

@nascheme
nascheme commented Dec 8, 2016

There are a couple of invalid string/byte escapes left in the code (Python 3.6 warn about them)::

./PIL/GimpPaletteFile.py:44: bad string escape 'if re.match(b"\w+:|#", s):'
./PIL/PngImagePlugin.py:51: bad string escape 'is_cid = re.compile(b"\w\w\w\w").match'
./PIL/XbmImagePlugin.py:29: bad string escape 'b"\s*#define[ \t]+.*_width[ \t]+(?P[0-9]+)[\r\n]+"'
./winbuild/build_dep.py:111: bad string escape '""" + "\n".join('set %s=%%BUILD%%\%s' % (k.upper(), v['dir'])'
./winbuild/build.py:19: bad string escape 'ret.append("%s%s%s\Scripts\pip.exe install nose" %'
./winbuild/build.py:22: bad string escape 'ret.append("%s%s%s\Scripts\pip.exe install unittest2" %'

@hugovk
Member
hugovk commented Dec 9, 2016

@nascheme What do you run on Python 3.6 to get these warnings?

@nascheme
nascheme commented Dec 9, 2016

It is a little script I wrote:
http://python.ca/nas/python/find_bad_escapes.py
I think ideally we would have a 2to3 like tool that just fixed the source code in-place.

@hugovk
Member
hugovk commented Dec 13, 2016

Looks like the PIL/ trio were fixed in PR #2186, and the build.py:22 one was removed by PR #2243, leaving:

./winbuild/build_dep.py:111: bad string escape '""" + "\n".join('set %s=%%BUILD%%%s' % (k.upper(), v['dir'])'
./winbuild/build.py:19: bad string escape 'ret.append("%s%s%s\Scripts\pip.exe install nose" %'

@aclark4life
Member

Is this one fixed then?

@aclark4life aclark4life added the Bug label Jan 8, 2017
@nascheme

Just the winbuild scripts are left to fix. This patch (untested) should fix them.

pillow-escape.txt

@hugovk
Member
hugovk commented Jan 12, 2017

PR: #2352.

@wiredfool wiredfool closed this in #2352 Jan 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment