Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
44bf8e1f
Commit
44bf8e1f
authored
Dec 28, 2016
by
Damien George
Browse files
py/mpprint: Add assertion for, and comment about, valid base values.
parent
ca7af9a7
Changes
1
Hide whitespace changes
Inline
Side-by-side
py/mpprint.c
View file @
44bf8e1f
...
...
@@ -202,6 +202,11 @@ STATIC int mp_print_int(const mp_print_t *print, mp_uint_t x, int sgn, int base,
}
int
mp_print_mp_int
(
const
mp_print_t
*
print
,
mp_obj_t
x
,
int
base
,
int
base_char
,
int
flags
,
char
fill
,
int
width
,
int
prec
)
{
// These are the only values for "base" that are required to be supported by this
// function, since Python only allows the user to format integers in these bases.
// If needed this function could be generalised to handle other values.
assert
(
base
==
2
||
base
==
8
||
base
==
10
||
base
==
16
);
if
(
!
MP_OBJ_IS_INT
(
x
))
{
// This will convert booleans to int, or raise an error for
// non-integer types.
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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