Skip to content

Commit

Permalink
Delete tkinter._ExceptionReportingCallback (python#10689)
Browse files Browse the repository at this point in the history
Co-authored-by: Alex Waygood <[email protected]>
  • Loading branch information
Akuli and AlexWaygood authored Sep 12, 2023
1 parent c31e12f commit fbd7963
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
7 changes: 2 additions & 5 deletions stdlib/tkinter/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ from enum import Enum
from tkinter.constants import *
from tkinter.font import _FontDescription
from types import TracebackType
from typing import Any, Generic, NamedTuple, Protocol, TypeVar, overload, type_check_only
from typing import Any, Generic, NamedTuple, TypeVar, overload, type_check_only
from typing_extensions import Literal, TypeAlias, TypedDict

if sys.version_info >= (3, 9):
Expand Down Expand Up @@ -720,9 +720,6 @@ class Wm:
def wm_withdraw(self) -> None: ...
withdraw = wm_withdraw

class _ExceptionReportingCallback(Protocol):
def __call__(self, __exc: type[BaseException], __val: BaseException, __tb: TracebackType | None) -> object: ...

class Tk(Misc, Wm):
master: None
def __init__(
Expand Down Expand Up @@ -764,7 +761,7 @@ class Tk(Misc, Wm):
config = configure
def destroy(self) -> None: ...
def readprofile(self, baseName: str, className: str) -> None: ...
report_callback_exception: _ExceptionReportingCallback
report_callback_exception: Callable[[type[BaseException], BaseException, TracebackType | None], object]
# Tk has __getattr__ so that tk_instance.foo falls back to tk_instance.tk.foo
# Please keep in sync with _tkinter.TkappType.
# Some methods are intentionally missing because they are inherited from Misc instead.
Expand Down
14 changes: 14 additions & 0 deletions test_cases/stdlib/check_tkinter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from __future__ import annotations

import tkinter
import traceback
import types


def custom_handler(exc: type[BaseException], val: BaseException, tb: types.TracebackType | None) -> None:
print("oh no")


root = tkinter.Tk()
root.report_callback_exception = traceback.print_exception
root.report_callback_exception = custom_handler

0 comments on commit fbd7963

Please sign in to comment.