From ed9f2949f65a78036da6241c31615c001e943041 Mon Sep 17 00:00:00 2001 From: Rich Chiodo Date: Wed, 12 Feb 2025 14:43:30 -0800 Subject: [PATCH] Handle invalid `__getattribute__` functions (#1833) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Handle invalid `__getattribute__` functions Addresses https://github.com/microsoft/debugpy/issues/1832 * Update src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_net_command.py Co-authored-by: Mike Fährmann --------- Co-authored-by: Mike Fährmann --- .../_vendored/pydevd/_pydevd_bundle/pydevd_net_command.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_net_command.py b/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_net_command.py index cc345f1c4..eeacbb3d5 100644 --- a/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_net_command.py +++ b/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_net_command.py @@ -77,7 +77,10 @@ def __init__(self, cmd_id, seq, text, is_json=False): as_dict["pydevd_cmd_id"] = cmd_id as_dict["seq"] = seq self.as_dict = as_dict - text = json.dumps(as_dict) + try: + text = json.dumps(as_dict) + except TypeError: + text = json.dumps(as_dict, default=str) assert isinstance(text, str)