2017-02-06 23:55:37 -05:00
|
|
|
"""
|
|
|
|
categories: Modules,json
|
|
|
|
description: JSON module does not throw exception when object is not serialisable
|
|
|
|
cause: Unknown
|
|
|
|
workaround: Unknown
|
|
|
|
"""
|
|
|
|
import json
|
2021-03-15 09:57:36 -04:00
|
|
|
|
2017-02-06 23:55:37 -05:00
|
|
|
a = bytes(x for x in range(256))
|
|
|
|
try:
|
|
|
|
z = json.dumps(a)
|
|
|
|
x = json.loads(z)
|
2021-03-15 09:57:36 -04:00
|
|
|
print("Should not get here")
|
2017-02-06 23:55:37 -05:00
|
|
|
except TypeError:
|
2021-03-15 09:57:36 -04:00
|
|
|
print("TypeError")
|