From 7c5cf59f8b9a5e62534e78558eb654bc664a3a6f Mon Sep 17 00:00:00 2001
From: Damien George <damien.p.george@gmail.com>
Date: Tue, 14 May 2019 14:45:54 +1000
Subject: [PATCH] extmod/modujson: Handle parsing of floats with + in the
 exponent.

Fixes issue #4780.
---
 extmod/modujson.c                 | 2 +-
 tests/extmod/ujson_loads_float.py | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/extmod/modujson.c b/extmod/modujson.c
index 830b588fd..f5c6428ef 100644
--- a/extmod/modujson.c
+++ b/extmod/modujson.c
@@ -185,7 +185,7 @@ STATIC mp_obj_t mod_ujson_load(mp_obj_t stream_obj) {
                     cur = S_CUR(s);
                     if (cur == '.' || cur == 'E' || cur == 'e') {
                         flt = true;
-                    } else if (cur == '-' || unichar_isdigit(cur)) {
+                    } else if (cur == '+' || cur == '-' || unichar_isdigit(cur)) {
                         // pass
                     } else {
                         break;
diff --git a/tests/extmod/ujson_loads_float.py b/tests/extmod/ujson_loads_float.py
index f1b8cc364..086853a2d 100644
--- a/tests/extmod/ujson_loads_float.py
+++ b/tests/extmod/ujson_loads_float.py
@@ -14,4 +14,5 @@ my_print(json.loads('1.2'))
 my_print(json.loads('1e2'))
 my_print(json.loads('-2.3'))
 my_print(json.loads('-2e3'))
+my_print(json.loads('-2e+3'))
 my_print(json.loads('-2e-3'))
-- 
GitLab