Skip to content

Commit 3a4a90f

Browse files
inspect: Add positions attributes that will be new in 3.11
python/cpython#91531
1 parent 3a98e8b commit 3a4a90f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

stdlib/inspect.pyi

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import dis
12
import enum
23
import sys
34
import types
@@ -465,6 +466,10 @@ class Traceback(NamedTuple):
465466
function: str
466467
code_context: list[str] | None
467468
index: int | None # type: ignore[assignment]
469+
if sys.version_info >= (3, 11):
470+
@property
471+
def positions(self) -> dis.Positions | None: ...
472+
def __new__(cls: type[Self], filename: str, lineno: int, function: str, code_context: list[str] | None, index: int | None, *, positions=None) -> Self: ...
468473

469474
class FrameInfo(NamedTuple):
470475
frame: FrameType
@@ -473,6 +478,10 @@ class FrameInfo(NamedTuple):
473478
function: str
474479
code_context: list[str] | None
475480
index: int | None # type: ignore[assignment]
481+
if sys.version_info >= (3, 11):
482+
@property
483+
def positions(self) -> dis.Positions | None: ...
484+
def __new__(cls: type[Self], frame: FrameType, filename: str, lineno: int, function: str, code_context: list[str] | None, index: int | None, *, positions=None) -> Self: ...
476485

477486
def getframeinfo(frame: FrameType | TracebackType, context: int = ...) -> Traceback: ...
478487
def getouterframes(frame: Any, context: int = ...) -> list[FrameInfo]: ...

0 commit comments

Comments
 (0)