mikeywaites / kim

Kim: A JSON Serialization and Marshaling framework
http://kim.readthedocs.org/en/latest/
Other
317 stars 17 forks source link

Raise error when trying to serialize None #167

Closed jackqu7 closed 7 years ago

jackqu7 commented 7 years ago

If you pass data instead of obj to a mapper and then try to serialise it, weird errors are likely to occur.

Serialise was calling the get_obj() method which should only be called on marshal, for serialise returning self.obj is enough - there is no benefit in instantiating a blank object if it's None. Instead detect if None and raise a helpful error.

128