MCPcopy Create free account
hub / github.com/apache/fory / increase_depth

Method increase_depth

python/pyfory/context.py:552–562  ·  view source on GitHub ↗
(self, diff=1)

Source from the content-addressed store, hash-verified

550 return self.context_objects.get(id(key), default)
551
552 def increase_depth(self, diff=1):
553 # Depth accounting is paired on the successful path only.
554 # If a nested read raises, the top-level deserialize/reset path clears
555 # `depth`, so nested readers must not add local try/finally wrappers
556 # around increase/decrease pairs.
557 self.depth += diff
558 if self.depth > self.max_depth:
559 raise Exception(
560 f"Read depth exceed max depth: {self.depth}, the deserialization data may be malicious. If it's not malicious, "
561 "please increase max read depth by Fory(..., max_depth=...)"
562 )
563
564 def decrease_depth(self, diff=1):
565 # Only call this after the matching nested read completed successfully.

Callers 7

_read_case_valueMethod · 0.45
_read_same_type_refMethod · 0.45
_read_different_typesMethod · 0.45
readMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected