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