diff --git a/stdlib/3/opcode.pyi b/stdlib/2and3/opcode.pyi similarity index 71% rename from stdlib/3/opcode.pyi rename to stdlib/2and3/opcode.pyi index e577a9ff5..a027963d3 100644 --- a/stdlib/3/opcode.pyi +++ b/stdlib/2and3/opcode.pyi @@ -1,5 +1,7 @@ from typing import List, Dict, Sequence +import sys + cmp_op = ... # type: Sequence[str] hasconst = ... # type: List[int] hasname = ... # type: List[int] @@ -13,6 +15,9 @@ opname = ... # type: List[str] opmap = ... # Dict[str, int] HAVE_ARGUMENT = ... # type: int EXTENDED_ARG = ... # type: int -hasnargs = ... # type: List[int] -def stack_effect(opcode: int, oparg: int = ...) -> int: ... +if sys.version_info >= (3, 4): + def stack_effect(opcode: int, oparg: int = ...) -> int: ... + +if sys.version_info >= (3, 6): + hasnargs = ... # type: List[int] diff --git a/stdlib/3/dis.pyi b/stdlib/3/dis.pyi index c63725691..a13443a5c 100644 --- a/stdlib/3/dis.pyi +++ b/stdlib/3/dis.pyi @@ -1,11 +1,18 @@ from typing import List, Union, Iterator, Tuple, Optional, Any, IO, NamedTuple, Dict -from opcode import (hasconst, hasname, hasjrel, hasjabs, haslocal, hascompare, - hasfree, hasnargs, cmp_op, opname, opmap, HAVE_ARGUMENT, - EXTENDED_ARG, stack_effect) - +import sys import types +from opcode import (hasconst, hasname, hasjrel, hasjabs, haslocal, hascompare, + hasfree, cmp_op, opname, opmap, HAVE_ARGUMENT, + EXTENDED_ARG) + +if sys.version_info >= (3, 4): + from opcode import stack_effect + +if sys.version_info >= (3, 6): + from opcode import hasnargs + _have_code = Union[types.MethodType, types.FunctionType, types.CodeType, type] _have_code_or_string = Union[_have_code, str, bytes]