|
1 | 1 | from types import FrameType |
2 | | -from typing import Any, AsyncGenerator, Coroutine, Generator, Tuple |
| 2 | +from typing import Any, AsyncGenerator, Coroutine, Generator, Tuple, Union |
3 | 3 |
|
4 | | -def get_frame_ip(frame: FrameType | Coroutine | Generator | AsyncGenerator) -> int: |
| 4 | +def get_frame_ip(frame: Union[FrameType, Coroutine, Generator, AsyncGenerator]) -> int: |
5 | 5 | """Get instruction pointer of a generator or coroutine.""" |
6 | 6 |
|
7 | | -def set_frame_ip(frame: FrameType | Coroutine | Generator | AsyncGenerator, ip: int): |
| 7 | +def set_frame_ip( |
| 8 | + frame: Union[FrameType, Coroutine, Generator, AsyncGenerator], ip: int |
| 9 | +): |
8 | 10 | """Set instruction pointer of a generator or coroutine.""" |
9 | 11 |
|
10 | | -def get_frame_sp(frame: FrameType | Coroutine | Generator | AsyncGenerator) -> int: |
| 12 | +def get_frame_sp(frame: Union[FrameType, Coroutine, Generator, AsyncGenerator]) -> int: |
11 | 13 | """Get stack pointer of a generator or coroutine.""" |
12 | 14 |
|
13 | | -def set_frame_sp(frame: FrameType | Coroutine | Generator | AsyncGenerator, sp: int): |
| 15 | +def set_frame_sp( |
| 16 | + frame: Union[FrameType, Coroutine, Generator, AsyncGenerator], sp: int |
| 17 | +): |
14 | 18 | """Set stack pointer of a generator or coroutine.""" |
15 | 19 |
|
16 | | -def get_frame_bp(frame: FrameType | Coroutine | Generator | AsyncGenerator) -> int: |
| 20 | +def get_frame_bp(frame: Union[FrameType, Coroutine, Generator, AsyncGenerator]) -> int: |
17 | 21 | """Get block pointer of a generator or coroutine.""" |
18 | 22 |
|
19 | | -def set_frame_bp(frame: FrameType | Coroutine | Generator | AsyncGenerator, bp: int): |
| 23 | +def set_frame_bp( |
| 24 | + frame: Union[FrameType, Coroutine, Generator, AsyncGenerator], bp: int |
| 25 | +): |
20 | 26 | """Set block pointer of a generator or coroutine.""" |
21 | 27 |
|
22 | 28 | def get_frame_stack_at( |
23 | | - frame: FrameType | Coroutine | Generator | AsyncGenerator, index: int |
| 29 | + frame: Union[FrameType, Coroutine, Generator, AsyncGenerator], index: int |
24 | 30 | ) -> Tuple[bool, Any]: |
25 | 31 | """Get an object from a generator or coroutine's stack, as an (is_null, obj) tuple.""" |
26 | 32 |
|
27 | 33 | def set_frame_stack_at( |
28 | | - frame: FrameType | Coroutine | Generator | AsyncGenerator, |
| 34 | + frame: Union[FrameType, Coroutine, Generator, AsyncGenerator], |
29 | 35 | index: int, |
30 | 36 | unset: bool, |
31 | 37 | value: Any, |
32 | 38 | ): |
33 | 39 | """Set or unset an object on the stack of a generator or coroutine.""" |
34 | 40 |
|
35 | 41 | def get_frame_block_at( |
36 | | - frame: FrameType | Coroutine | Generator | AsyncGenerator, index: int |
| 42 | + frame: Union[FrameType, Coroutine, Generator, AsyncGenerator], index: int |
37 | 43 | ) -> Tuple[int, int, int]: |
38 | 44 | """Get a block from a generator or coroutine.""" |
39 | 45 |
|
40 | 46 | def set_frame_block_at( |
41 | | - frame: FrameType | Coroutine | Generator | AsyncGenerator, |
| 47 | + frame: Union[FrameType, Coroutine, Generator, AsyncGenerator], |
42 | 48 | index: int, |
43 | 49 | value: Tuple[int, int, int], |
44 | 50 | ): |
45 | 51 | """Restore a block of a generator or coroutine.""" |
46 | 52 |
|
47 | 53 | def get_frame_state( |
48 | | - frame: FrameType | Coroutine | Generator | AsyncGenerator, |
| 54 | + frame: Union[FrameType, Coroutine, Generator, AsyncGenerator], |
49 | 55 | ) -> int: |
50 | 56 | """Get frame state of a generator or coroutine.""" |
51 | 57 |
|
52 | 58 | def set_frame_state( |
53 | | - frame: FrameType | Coroutine | Generator | AsyncGenerator, state: int |
| 59 | + frame: Union[FrameType, Coroutine, Generator, AsyncGenerator], state: int |
54 | 60 | ): |
55 | 61 | """Set frame state of a generator or coroutine.""" |
0 commit comments