Skip to content

Commit d7e9af4

Browse files
JelleZijlstrasrittau
authored andcommitted
allow callables in dis() (#2969)
Fixes #2914
1 parent bdb1de5 commit d7e9af4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

stdlib/2and3/dis.pyi

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import List, Union, Iterator, Tuple, Optional, Any, IO, NamedTuple, Dict
1+
from typing import Callable, List, Union, Iterator, Tuple, Optional, Any, IO, NamedTuple, Dict
22

33
import sys
44
import types
@@ -14,7 +14,9 @@ if sys.version_info >= (3, 4):
1414
if sys.version_info >= (3, 6):
1515
from opcode import hasnargs as hasnargs
1616

17-
_have_code = Union[types.MethodType, types.FunctionType, types.CodeType, type]
17+
# Strictly this should not have to include Callable, but mypy doesn't use FunctionType
18+
# for functions (python/mypy#3171)
19+
_have_code = Union[types.MethodType, types.FunctionType, types.CodeType, type, Callable[..., Any]]
1820
_have_code_or_string = Union[_have_code, str, bytes]
1921

2022

0 commit comments

Comments
 (0)