Skip to content

Commit c4d4d7d

Browse files
committed
Check code object by isinstance
1 parent 2c291f0 commit c4d4d7d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Lib/bdb.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import weakref
88
from contextlib import contextmanager, suppress
99
from inspect import CO_GENERATOR, CO_COROUTINE, CO_ASYNC_GENERATOR
10+
from types import CodeType
1011

1112
__all__ = ["BdbQuit", "Bdb", "Breakpoint"]
1213

@@ -183,7 +184,7 @@ def _get_executable_linenos(code):
183184
if lineno is not None:
184185
linenos.add(lineno)
185186
for const in code.co_consts:
186-
if hasattr(const, 'co_lines'):
187+
if isinstance(const, CodeType):
187188
linenos |= _get_executable_linenos(const)
188189
return linenos
189190

0 commit comments

Comments
 (0)