Message295127
Here is the relevant code snippet from decode_generalized_number() in punycode.py
try:
char = ord(extended[extpos])
except IndexError:
if errors == "strict":
raise UnicodeError("incomplete punicode string")
return extpos + 1, None
extpos += 1
if 0x41 <= char <= 0x5A: # A-Z
digit = char - 0x41
elif 0x30 <= char <= 0x39:
digit = char - 22 # 0x30-26
elif errors == "strict":
raise UnicodeError("Invalid extended code point '%s'"
% extended[extpos])
While raising the UnicodeError() in the last line above, it accesses extended[extpos]. However extpos was incremented by 1 a few lines above that. This causes two errors:
1) The UnicodeError() prints the wrong character (the one after the character we want)
2) If the previous extpos was the last character in the string, then attempting to print character at extpos+1 will raise an IndexError. |
|
Date |
User |
Action |
Args |
2017-06-04 15:49:54 | Vikram Hegde | set | recipients:
+ Vikram Hegde |
2017-06-04 15:49:54 | Vikram Hegde | set | messageid: <1496591394.26.0.00653153658066.issue30566@psf.upfronthosting.co.za> |
2017-06-04 15:49:54 | Vikram Hegde | link | issue30566 messages |
2017-06-04 15:49:54 | Vikram Hegde | create | |
|