Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
6e8085b4
Commit
6e8085b4
authored
May 10, 2014
by
Paul Sokolovsky
Browse files
py: Fix base "detection" for int('0<hexdigit>', 16).
parent
7b0f9a7d
Changes
2
Hide whitespace changes
Inline
Side-by-side
py/parsenumbase.c
View file @
6e8085b4
...
...
@@ -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'
)
{
...
...
tests/basics/int1.py
View file @
6e8085b4
...
...
@@ -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
))
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment