aboutsummaryrefslogtreecommitdiff
path: root/py/mpprint.h
diff options
context:
space:
mode:
authorPeter Züger <zueger.peter@icloud.com>2021-02-03 09:24:25 +0100
committerDamien George <damien@micropython.org>2021-08-07 13:52:16 +1000
commitffc854f17f1c4a3a9904fa8909f0b6ab5385206f (patch)
tree889276a0ee111c6f771248e32ab1a6b07b3f2890 /py/mpprint.h
parent8616129f2e382310802950db066178648a9429a3 (diff)
extmod/modujson: Add support for dump/dumps separators keyword-argument.
Optionally enabled via MICROPY_PY_UJSON_SEPARATORS. Enabled by default. For dump, make sure mp_get_stream_raise is called after mod_ujson_separators since CPython does it in this order (if both separators and stream are invalid, separators will raise an exception first). Add separators argument in the docs as well. Signed-off-by: Peter Züger <zueger.peter@icloud.com> Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'py/mpprint.h')
-rw-r--r--py/mpprint.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/py/mpprint.h b/py/mpprint.h
index aef9015de..0dff9a770 100644
--- a/py/mpprint.h
+++ b/py/mpprint.h
@@ -52,6 +52,14 @@ typedef struct _mp_print_t {
mp_print_strn_t print_strn;
} mp_print_t;
+typedef struct _mp_print_ext_t {
+ mp_print_t base;
+ const char *item_separator;
+ const char *key_separator;
+}mp_print_ext_t;
+
+#define MP_PRINT_GET_EXT(print) ((mp_print_ext_t *)print)
+
// All (non-debug) prints go through one of the two interfaces below.
// 1) Wrapper for platform print function, which wraps MP_PLAT_PRINT_STRN.
extern const mp_print_t mp_plat_print;