We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 331a481 commit 9e67711Copy full SHA for 9e67711
py/mpprint.c
@@ -494,16 +494,16 @@ int mp_vprintf(const mp_print_t *print, const char *fmt, va_list args) {
494
break;
495
}
496
case 'u':
497
- chrs += mp_print_int(print, va_arg(args, int), 0, 10, 'a', flags, fill, width);
+ chrs += mp_print_int(print, va_arg(args, unsigned int), 0, 10, 'a', flags, fill, width);
498
499
case 'd':
500
chrs += mp_print_int(print, va_arg(args, int), 1, 10, 'a', flags, fill, width);
501
502
case 'x':
503
- chrs += mp_print_int(print, va_arg(args, int), 0, 16, 'a', flags, fill, width);
+ chrs += mp_print_int(print, va_arg(args, unsigned int), 0, 16, 'a', flags, fill, width);
504
505
case 'X':
506
- chrs += mp_print_int(print, va_arg(args, int), 0, 16, 'A', flags, fill, width);
+ chrs += mp_print_int(print, va_arg(args, unsigned int), 0, 16, 'A', flags, fill, width);
507
508
case 'p':
509
case 'P': // don't bother to handle upcase for 'P'
tests/unix/extra_coverage.py.exp
@@ -8,6 +8,10 @@ ab abc
8
false true
9
(null)
10
t
11
+-2147483648
12
+2147483648
13
+80000000
14
15
# vstr
16
tests
17
sts
unix/coverage.c
@@ -22,6 +22,10 @@ STATIC mp_obj_t extra_coverage(void) {
22
mp_printf(&mp_plat_print, "%b %b\n", 0, 1); // bools
23
mp_printf(&mp_plat_print, "%s\n", NULL); // null string
24
mp_printf(&mp_plat_print, "%t\n"); // non-format char
25
+ mp_printf(&mp_plat_print, "%d\n", 0x80000000); // should print signed
26
+ mp_printf(&mp_plat_print, "%u\n", 0x80000000); // should print unsigned
27
+ mp_printf(&mp_plat_print, "%x\n", 0x80000000); // should print unsigned
28
+ mp_printf(&mp_plat_print, "%X\n", 0x80000000); // should print unsigned
29
30
31
// vstr
0 commit comments