xonsh/lazyasd

LazyObject in dictionaries don't serialize

Opened this issue · 0 comments

image

@scopatz @gforsyth

json.dumps({"key": LazyObject(lambda: "nope", {}, 'lo')})  # TypeError: Object of type str is not JSON serializable

Gives the confusing (pun) error message of TypeError: Object of type str is not JSON serializable. Yes it is, Mr. Python, Sir!

Not sure but maybe the __hash__ method must be passed through or something. One might think about pickle and __get_state__, too.