File: 0007-use-default_factory-for-parser_options-field-5476.patch

package info (click to toggle)
mitmproxy 8.1.1-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 38,848 kB
  • sloc: python: 53,317; javascript: 1,603; xml: 186; sh: 105; ansic: 68; makefile: 13
file content (34 lines) | stat: -rw-r--r-- 1,144 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
From 55a64b7ad993fd52fbff19f33e3c6e153b3e8d9b Mon Sep 17 00:00:00 2001
From: rathann <dominik@greysector.net>
Date: Sat, 23 Jul 2022 10:15:03 +0200
Subject: [PATCH] use default_factory for parser_options field (#5476)

* use default_factory for field parser_options

When running mitmproxy under python 3.11, the following exception
is thrown otherwise:
```
ValueError: mutable default <class 'mitmproxy.contentviews.grpc.ProtoParser.ParserOptions'> for field parser_options is not allowed: use default_factory
```

Fixes #5474.
---
 mitmproxy/contentviews/grpc.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mitmproxy/contentviews/grpc.py b/mitmproxy/contentviews/grpc.py
index a5ef99708..5c73220c8 100644
--- a/mitmproxy/contentviews/grpc.py
+++ b/mitmproxy/contentviews/grpc.py
@@ -951,7 +951,7 @@ def format_grpc(
 
 @dataclass
 class ViewConfig:
-    parser_options: ProtoParser.ParserOptions = ProtoParser.ParserOptions()
+    parser_options: ProtoParser.ParserOptions = field(default_factory=ProtoParser.ParserOptions)
     parser_rules: list[ProtoParser.ParserRule] = field(default_factory=list)
 
 
-- 
2.30.2