Skip to content

Commit 4b364fd

Browse files
authored
fix(serializer): Add type annotations to databag limits (#7505)
### Description Add `int` annotations to `MAX_DATABAG_DEPTH` and `MAX_DATABAG_BREADTH` in `serializer.py`. Without them, ty infers the variables as `Literal[5]` / `Literal[10]` and reports `invalid-assignment` when users reassign them (e.g. `sentry_sdk.serializer.MAX_DATABAG_DEPTH = 15`). I checked this with ty locally: the errors go away after this change. No runtime change. As discussed in the issue, `MAX_EVENT_BYTES` is left as is. This is my first open source contribution ever, so thanks @sentrivana for the quick reply on the issue, and I'm happy to make any changes if needed! #### Issues * resolves: #7503 * resolves: PY-2782
1 parent 990839c commit 4b364fd

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎sentry_sdk/serializer.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@
4343

4444
# Maximum depth and breadth of databags. Excess data will be trimmed. If
4545
# max_request_body_size is "always", request bodies won't be trimmed.
46-
MAX_DATABAG_DEPTH = 5
47-
MAX_DATABAG_BREADTH = 10
46+
MAX_DATABAG_DEPTH: int = 5
47+
MAX_DATABAG_BREADTH: int = 10
4848
CYCLE_MARKER = "<cyclic>"
4949

5050

0 commit comments

Comments
 (0)