From f7f754dab68ee95927fa6f6dec1eea111f334aa4 Mon Sep 17 00:00:00 2001 From: Rich Chiodo Date: Wed, 12 Feb 2025 09:59:49 -0800 Subject: [PATCH 1/2] Handle invalid `__getattribute__` functions Addresses https://github.com/microsoft/debugpy/issues/1832 --- .../_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..4ca2e0c84 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=lambda o: str(o)) assert isinstance(text, str) From 244f830871029f8416023730fce54fdfb3e24b8c Mon Sep 17 00:00:00 2001 From: Rich Chiodo Date: Wed, 12 Feb 2025 10:25:27 -0800 Subject: [PATCH 2/2] Update src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_net_command.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Mike Fährmann --- .../_vendored/pydevd/_pydevd_bundle/pydevd_net_command.py | 2 +- 1 file changed, 1 insertion(+), 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 4ca2e0c84..eeacbb3d5 100644 --- a/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_net_command.py +++ b/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_net_command.py @@ -80,7 +80,7 @@ def __init__(self, cmd_id, seq, text, is_json=False): try: text = json.dumps(as_dict) except TypeError: - text = json.dumps(as_dict, default=lambda o: str(o)) + text = json.dumps(as_dict, default=str) assert isinstance(text, str)