Skip to content

Commit 3a7d01e

Browse files
Relax simplejson dependency and keep it backwards compatible (#152)
Simplejson had a breaking change from 3.18.4 (existing) going to 3.19 where the default behaviour of the JSONEncoder changed with respect to NaN handling. We address that in a backwards compatible way by passing `allow_nan=True`.
1 parent c00b4e7 commit 3a7d01e

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

awslambdaric/lambda_runtime_marshaller.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
class Encoder(json.JSONEncoder):
1717
def __init__(self):
1818
if os.environ.get("AWS_EXECUTION_ENV") == "AWS_Lambda_python3.12":
19-
super().__init__(use_decimal=False, ensure_ascii=False)
19+
super().__init__(use_decimal=False, ensure_ascii=False, allow_nan=True)
2020
else:
21-
super().__init__(use_decimal=False)
21+
super().__init__(use_decimal=False, allow_nan=True)
2222

2323
def default(self, obj):
2424
if isinstance(obj, decimal.Decimal):

requirements/base.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
simplejson==3.18.4
1+
simplejson>=3.18.4

0 commit comments

Comments
 (0)