You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(serializer): avoid creating reference cycles on every call (#6563)
Nested serializer functions are moved to methods of a new `_Serializer` class, and `serialize()` creates an instance of the class.
Prevents leaving reference cycles behind that only the cyclic GC can free.
A very smart serializer that takes a dict and emits a json-friendly dict.
95
-
Currently used for serializing the final Event and also prematurely while fetching the stack
96
-
local variables for each frame in a stacktrace.
97
-
98
-
It works internally with 'databags' which are arbitrary data structures like Mapping, Sequence and Set.
99
-
The algorithm itself is a recursive graph walk down the data structures it encounters.
100
-
101
-
It has the following responsibilities:
102
-
* Trimming databags and keeping them within MAX_DATABAG_BREADTH and MAX_DATABAG_DEPTH.
103
-
* Calling safe_repr() on objects appropriately to keep them informative and readable in the final payload.
104
-
* Annotating the payload with the _meta field whenever trimming happens.
105
-
106
-
:param max_request_body_size: If set to "always", will never trim request bodies.
107
-
:param max_value_length: The max length to strip strings to, or None to disable string truncation. Defaults to None.
108
-
:param is_vars: If we're serializing vars early, we want to repr() things that are JSON-serializable to make their type more apparent. For example, it's useful to see the difference between a unicode-string and a bytestring when viewing a stacktrace.
109
-
:param custom_repr: A custom repr function that runs before safe_repr on the object to be serialized. If it returns None or throws internally, we will fallback to safe_repr.
A very smart serializer that takes a dict and emits a json-friendly dict.
382
+
Currently used for serializing the final Event and also prematurely while fetching the stack
383
+
local variables for each frame in a stacktrace.
384
+
385
+
It works internally with 'databags' which are arbitrary data structures like Mapping, Sequence and Set.
386
+
The algorithm itself is a recursive graph walk down the data structures it encounters.
387
+
388
+
It has the following responsibilities:
389
+
* Trimming databags and keeping them within MAX_DATABAG_BREADTH and MAX_DATABAG_DEPTH.
390
+
* Calling safe_repr() on objects appropriately to keep them informative and readable in the final payload.
391
+
* Annotating the payload with the _meta field whenever trimming happens.
392
+
393
+
:param max_request_body_size: If set to "always", will never trim request bodies.
394
+
:param max_value_length: The max length to strip strings to, or None to disable string truncation. Defaults to None.
395
+
:param is_vars: If we're serializing vars early, we want to repr() things that are JSON-serializable to make their type more apparent. For example, it's useful to see the difference between a unicode-string and a bytestring when viewing a stacktrace.
396
+
:param custom_repr: A custom repr function that runs before safe_repr on the object to be serialized. If it returns None or throws internally, we will fallback to safe_repr.
0 commit comments