py: Fix base "detection" for int('0<hexdigit>', 16).

This commit is contained in:
Paul Sokolovsky 2014-05-10 04:42:56 +03:00
parent 7b0f9a7d9b
commit 6e8085b425
2 changed files with 4 additions and 1 deletions

View File

@ -42,7 +42,9 @@ int mp_parse_num_base(const char *str, uint len, int *base) {
} else if (*base == 0 && (c | 32) == 'b') {
*base = 2;
} else {
*base = 10;
if (*base == 0) {
*base = 10;
}
p -= 2;
}
} else if (*base == 8 && c == '0') {

View File

@ -37,6 +37,7 @@ print(int('0o123', 0))
print(int('8388607'))
print(int('0x123', 16))
print(int('0X123', 16))
print(int('0A', 16))
print(int('0o123', 8))
print(int('0O123', 8))
print(int('0123', 8))