Skip to content

Commit 1d64e2b

Browse files
committed
Add and fix tests
1 parent 5c891db commit 1d64e2b

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

stdlib/@tests/test_cases/check_tkinter.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,14 @@ def custom_handler(exc: type[BaseException], val: BaseException, tb: types.Trace
1313

1414

1515
root = tkinter.Tk()
16-
root.report_callback_exception = traceback.print_exception
17-
root.report_callback_exception = custom_handler
16+
root.report_callback_exception = traceback.print_exception # type: ignore[method-assign]
17+
root.report_callback_exception = custom_handler # type: ignore[method-assign]
18+
root.report_callback_exception(TypeError, TypeError("no"), None)
19+
20+
21+
class App(tkinter.Tk):
22+
def report_callback_exception(self, exc: type[BaseException], val: BaseException, tb: types.TracebackType | None) -> None:
23+
print("oh no")
1824

1925

2026
def foo(x: int, y: str) -> None:

stdlib/tkinter/__init__.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1063,7 +1063,8 @@ class Tk(Misc, Wm):
10631063
config = configure
10641064
def destroy(self) -> None: ...
10651065
def readprofile(self, baseName: str, className: str) -> None: ...
1066-
def report_callback_exception(self, exc: type[BaseException], val: BaseException, tb: TracebackType | None) -> object: ...
1066+
def report_callback_exception(self, exc: type[BaseException], val: BaseException, tb: TracebackType | None, /) -> object: ...
1067+
10671068
# Tk has __getattr__ so that tk_instance.foo falls back to tk_instance.tk.foo
10681069
# Please keep in sync with _tkinter.TkappType.
10691070
# Some methods are intentionally missing because they are inherited from Misc instead.

0 commit comments

Comments
 (0)