mirror of
https://github.com/python/cpython.git
synced 2025-11-08 21:52:45 +00:00
Two buglet fixes. Peter Funk caught the bug in make_escapes:
This will fold all ISO 8859 chars from the upper half of the
charset into the lower half, which is ...ummm.... unintened.
The second is a typo in the reference to options.escape in main().
This commit is contained in:
parent
c8f0892d12
commit
7733e12c9c
1 changed files with 9 additions and 7 deletions
|
|
@ -165,13 +165,15 @@ escapes = []
|
||||||
|
|
||||||
def make_escapes(pass_iso8859):
|
def make_escapes(pass_iso8859):
|
||||||
global escapes
|
global escapes
|
||||||
for i in range(256):
|
|
||||||
if pass_iso8859:
|
if pass_iso8859:
|
||||||
# Allow iso-8859 characters to pass through so that e.g. 'msgid
|
# Allow iso-8859 characters to pass through so that e.g. 'msgid
|
||||||
# "Höhe"' would result not result in 'msgid "H\366he"'. Otherwise
|
# "Höhe"' would result not result in 'msgid "H\366he"'. Otherwise we
|
||||||
# we escape any character outside the 32..126 range.
|
# escape any character outside the 32..126 range.
|
||||||
i = i % 128
|
mod = 128
|
||||||
if 32 <= i <= 126:
|
else:
|
||||||
|
mod = 256
|
||||||
|
for i in range(256):
|
||||||
|
if 32 <= (i % mod) <= 126:
|
||||||
escapes.append(chr(i))
|
escapes.append(chr(i))
|
||||||
else:
|
else:
|
||||||
escapes.append("\\%03o" % i)
|
escapes.append("\\%03o" % i)
|
||||||
|
|
@ -373,7 +375,7 @@ def main():
|
||||||
options.excludefilename = arg
|
options.excludefilename = arg
|
||||||
|
|
||||||
# calculate escapes
|
# calculate escapes
|
||||||
make_escapes(options.escapes)
|
make_escapes(options.escape)
|
||||||
|
|
||||||
# calculate all keywords
|
# calculate all keywords
|
||||||
options.keywords.extend(default_keywords)
|
options.keywords.extend(default_keywords)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue