Changes between Version 82 and Version 83 of pyson
- Timestamp:
- 11/05/24 15:49:45 (3 weeks ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
pyson
v82 v83 76 76 The following types are recognised and handled separately: 77 77 78 NoneType, int, float, bool, str, complex, range, bytes, bytearray, datetime, [https://tracinsy.ewi.tudelft.nl/pubtrac/Utilities/wiki/uri URI], UUID, Decimal, dict, list, Exceptions (see below) 78 NoneType, int, float, bool, str, complex, range, bytes, bytearray, datetime, [https://tracinsy.ewi.tudelft.nl/pubtrac/Utilities/wiki/uri URI], UUID, Decimal, dict, list, Exceptions (see below). objects of type Type (class objects) are also treated specially. 79 79 80 80 The dict and list are treated even more special as we also support the List[TYPE] and Dict[KEYTYPE, VALUETYPE] types. … … 96 96 Serialization of an exception gives {{{ {"message":"...", "cause": EX, "stackTrace":[]} }}} where EX is either None or another serialized exception. This format tries to maximize compatibility with the jackson way of serializing exceptions. The "stackTrace" field is always empty because python does not include the stacktrace with exceptions; it's there only for compatibility of the format with java. Note that the type of the exception is not included (as in jackson). 97 97 Deserialization takes a dict with at least a "message" field. The constructor of the provided class is called with this message, so make sure that your exception constructor takes the message as the constructor argument. If the dict contains a cause, the cause is also parsed recursively, as general Exception, and attribute {{{__cause__}}} of the exception is filled with the result. 98 99 === Type[X] 100 Objects of type Type[Clazz[ are class objects. For example, Type[Bid] is referring to the class Bid. They are serialized as the full.path.to.Clazz. For deserialization, the class is loaded and checked whether it's a subtype of the specified type. Note, Type[Bid] refers to an object of class Bid, where Bid refers to an instance of class Bid. 98 101 99 102 == Decorators