From eecd7744c4763832fa80311f5791016706df8d16 Mon Sep 17 00:00:00 2001 From: Jonas Tingeborn Date: Sat, 6 Aug 2022 10:53:57 +0200 Subject: [PATCH 1/2] Fix crash from missing co_lines in python 3.10 --- pydump.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pydump.py b/pydump.py index e1418bc..9b2b805 100644 --- a/pydump.py +++ b/pydump.py @@ -138,6 +138,10 @@ def __init__(self, code): self.co_lnotab = code.co_lnotab self.co_varnames = code.co_varnames self.co_flags = code.co_flags + self._co_lines = list(code.co_lines()) if hasattr(code, 'co_lines') else [] + + def co_lines(self): + return iter(self._co_lines) class FakeFrame(object): From 4e3714bac5b911facc18065e6ec9c2891cc52713 Mon Sep 17 00:00:00 2001 From: Jonas Tingeborn Date: Sat, 6 Aug 2022 11:50:28 +0200 Subject: [PATCH 2/2] Fix pdb args command for python >=3.8 --- pydump.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pydump.py b/pydump.py index 9b2b805..1fbc162 100644 --- a/pydump.py +++ b/pydump.py @@ -139,6 +139,8 @@ def __init__(self, code): self.co_varnames = code.co_varnames self.co_flags = code.co_flags self._co_lines = list(code.co_lines()) if hasattr(code, 'co_lines') else [] + if hasattr(code, 'co_kwonlyargcount'): + self.co_kwonlyargcount = code.co_kwonlyargcount def co_lines(self): return iter(self._co_lines)