Skip to content

Commit cd93803

Browse files
authored
Narrow ProfileFunction and TraceFunction
1 parent 098f30e commit cd93803

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

stdlib/_typeshed/__init__.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,10 +350,10 @@ AnyOrLiteralStr = TypeVar("AnyOrLiteralStr", str, bytes, LiteralString) # noqa:
350350
StrOrLiteralStr = TypeVar("StrOrLiteralStr", LiteralString, str) # noqa: Y001
351351

352352
# Objects suitable to be passed to sys.setprofile, threading.setprofile, and similar
353-
ProfileFunction: TypeAlias = Callable[[FrameType, str, Any], object]
353+
ProfileFunction: TypeAlias = Callable[[FrameType, Literal["call", "return", "c_call", "c_return", "c_exception"], Any], object]
354354

355355
# Objects suitable to be passed to sys.settrace, threading.settrace, and similar
356-
TraceFunction: TypeAlias = Callable[[FrameType, str, Any], TraceFunction | None]
356+
TraceFunction: TypeAlias = Callable[[FrameType, Literal["call", "line", "return", "exception", "opcode"], Any], TraceFunction | None]
357357

358358
# experimental
359359
# Might not work as expected for pyright, see

0 commit comments

Comments
 (0)