Skip to content

Commit 46330bd

Browse files
committed
Merge pull request #407 from dhylands/str-format
Enhance str.format support
2 parents e44d26a + baf6f14 commit 46330bd

File tree

8 files changed

+776
-141
lines changed

8 files changed

+776
-141
lines changed

py/formatfloat.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
***********************************************************************/
1515

1616
#include <stdlib.h>
17+
#include <stdint.h>
1718

1819
#include "mpconfig.h"
1920

py/obj.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,10 @@ machine_int_t mp_obj_get_int(mp_obj_t arg) {
198198
return MP_OBJ_SMALL_INT_VALUE(arg);
199199
} else if (MP_OBJ_IS_TYPE(arg, &mp_type_int)) {
200200
return mp_obj_int_get_checked(arg);
201+
#if MICROPY_ENABLE_FLOAT
202+
} else if (MP_OBJ_IS_TYPE(arg, &mp_type_float)) {
203+
return mp_obj_float_get(arg);
204+
#endif
201205
} else {
202206
nlr_jump(mp_obj_new_exception_msg_varg(&mp_type_TypeError, "can't convert %s to int", mp_obj_get_type_str(arg)));
203207
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy