PEP 263: Fix escaping of "\"s in regex and strings (#220)

Observed to be missing the backslashes on
https://www.python.org/dev/peps/pep-0263/#defining-the-encoding
This commit is contained in:
Alex Vandiver 2017-03-09 23:55:19 -08:00 committed by Berker Peksag
parent 4c46c57100
commit 1c7a9828e2
1 changed files with 6 additions and 3 deletions

View File

@ -69,8 +69,11 @@ or::
#!/usr/bin/python #!/usr/bin/python
# vim: set fileencoding=<encoding name> : # vim: set fileencoding=<encoding name> :
More precisely, the first or second line must match the regular More precisely, the first or second line must match the following
expression "^[ \t\v]*#.*?coding[:=][ \t]*([-_.a-zA-Z0-9]+)". regular expression::
^[ \t\v]*#.*?coding[:=][ \t]*([-_.a-zA-Z0-9]+)
The first group of this The first group of this
expression is then interpreted as encoding name. If the encoding expression is then interpreted as encoding name. If the encoding
is unknown to Python, an error is raised during compilation. There is unknown to Python, an error is raised during compilation. There
@ -80,7 +83,7 @@ is ignored.
To aid with platforms such as Windows, which add Unicode BOM marks To aid with platforms such as Windows, which add Unicode BOM marks
to the beginning of Unicode files, the UTF-8 signature to the beginning of Unicode files, the UTF-8 signature
'\xef\xbb\xbf' will be interpreted as 'utf-8' encoding as well ``\xef\xbb\xbf`` will be interpreted as 'utf-8' encoding as well
(even if no magic encoding comment is given). (even if no magic encoding comment is given).
If a source file uses both the UTF-8 BOM mark signature and a If a source file uses both the UTF-8 BOM mark signature and a