René's URL Explorer Experiment


Title: Tk.report_callback_exception type annotation breaks subclass override compatibility · Issue #15840 · python/typeshed · GitHub

Open Graph Title: Tk.report_callback_exception type annotation breaks subclass override compatibility · Issue #15840 · python/typeshed

X Title: Tk.report_callback_exception type annotation breaks subclass override compatibility · Issue #15840 · python/typeshed

Description: Problem The current type annotation for Tk.report_callback_exception in typeshed, introduced in #2498, causes a regression when subclassing tkinter.Tk and overriding the method. Issue 1: Incompatible override error in pyright When subcla...

Open Graph Description: Problem The current type annotation for Tk.report_callback_exception in typeshed, introduced in #2498, causes a regression when subclassing tkinter.Tk and overriding the method. Issue 1: Incompatib...

X Description: Problem The current type annotation for Tk.report_callback_exception in typeshed, introduced in #2498, causes a regression when subclassing tkinter.Tk and overriding the method. Issue 1: Incompatib...

Opengraph URL: https://github.com/python/typeshed/issues/15840

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Tk.report_callback_exception type annotation breaks subclass override compatibility","articleBody":"## Problem\n\nThe current type annotation for `Tk.report_callback_exception` in typeshed, introduced in #2498, causes a regression when subclassing `tkinter.Tk` and overriding the method.\n\n### Issue 1: Incompatible override error in pyright\n\nWhen subclassing `Tk` and overriding `report_callback_exception` with the correct runtime signature, pyright reports an incompatible method override error.\n\n**Code:**\n```python\nfrom tkinter import Tk\nfrom types import TracebackType\nfrom typing import override\n\n\nclass App(Tk):\n    @override\n    def report_callback_exception(\n        self,\n        exc_type: type[BaseException],\n        exc_value: BaseException,\n        exc_traceback: TracebackType | None,\n    ):\n        pass\n```\n\n**pyright output:**\n```pwsh\n(report-callback-exception) PS G:\\programming\\python\\lab\\report_callback_exception> pyright\ng:\\programming\\python\\lab\\report_callback_exception\\main.py\n  g:\\programming\\python\\lab\\report_callback_exception\\main.py:8:9 - error: Method \"report_callback_exception\" overrides class \"Tk\" in an incompatible manner\n    Positional parameter count mismatch; base method has 3, but override has 4\n    Parameter 2 type mismatch: base parameter is type \"BaseException\", override parameter is type \"type[BaseException]\"\n    Parameter 3 type mismatch: base parameter is type \"TracebackType | None\", override parameter is type \"BaseException\"\n      Type \"BaseException\" is not assignable to type \"type[BaseException]\"\n      Type \"TracebackType | None\" is not assignable to type \"BaseException\"\n        \"TracebackType\" is not assignable to \"BaseException\" (reportIncompatibleMethodOverride)\n1 error, 0 warnings, 0 informations\n```\n\n### Issue 2: Missing error on invalid manual call\n\nConversely, pyright does **not** report an error when manually calling `Tk.report_callback_exception` with the wrong signature, even though the code fails at runtime.\n\n**Code:**\n```python\nfrom tkinter import Tk\nimport sys\n\n\ndef main():\n    try:\n        print(0 / 0)\n    except Exception:\n        exc_type, exc_value, exc_traceback = sys.exc_info()\n        assert exc_type is not None\n        assert exc_value is not None\n        Tk.report_callback_exception(exc_type, exc_value, exc_traceback)\n```\n\n**Runtime error:**\n```pwsh\n(report-callback-exception) PS G:\\programming\\python\\lab\\report_callback_exception> & g:\\programming\\python\\lab\\report_callback_exception\\.venv\\Scripts\\python.exe g:/programming/python/lab/report_callback_exception/main.py\nTraceback (most recent call last):\n  File \"g:\\programming\\python\\lab\\report_callback_exception\\main.py\", line 7, in main\n    0 / 0\n    ~~^~~\nZeroDivisionError: division by zero\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n  File \"g:\\programming\\python\\lab\\report_callback_exception\\main.py\", line 16, in \u003cmodule>\n    main()\n    ~~~~^^\n  File \"g:\\programming\\python\\lab\\report_callback_exception\\main.py\", line 12, in main\n    Tk.report_callback_exception(exc_type, exc_value, exc_traceback)\n    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nTypeError: Tk.report_callback_exception() missing 1 required positional argument: 'tb'\n```\n\n**pyright output:**\n```pwsh\n(report-callback-exception) PS G:\\programming\\python\\lab\\report_callback_exception> pyright\n0 errors, 0 warnings, 0 informations\n```\n\n## Expected behavior\n\nThe type annotation should match the actual runtime signature as used in practice.\n\n## Additional context\n\n~~srittau said in https://github.com/python/typeshed/issues/1767#issuecomment-680798604:~~\n\n> ~~\"This looks more like a mypy problem to me. It is somehow expecting an additional self argument here.\"~~\n\n~~If that is indeed the case, I think we should revert the type annotation for `report_callback_exception` and report the error to mypy instead, because the root cause is not here.~~\n\nThe above statement is irrelevant to this issue.\n\nmypy's error when assigning to a method is [intentional](https://mypy.readthedocs.io/en/stable/error_code_list.html#check-that-assignment-target-is-not-a-method-method-assign), therefore #1767 is not an issue.\n\n","author":{"url":"https://github.com/Jesse205","@type":"Person","name":"Jesse205"},"datePublished":"2026-05-27T12:42:14Z","url":"https://github.com/python/typeshed/issues/15840"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:57f266b3-653e-7314-4c01-ff3a8d28797f
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id8C44:5875E:21A4F0C:2DBA3B3:6B002396
html-safe-noncecc163f6eb925a4f7aeddeef5ece6379e38e98e3c0952a9e7ee24d7ff7f150548
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QzQ0OjU4NzVFOjIxQTRGMEM6MkRCQTNCMzo2QjAwMjM5NiIsInZpc2l0b3JfaWQiOiIzOTI2MDkxNjgyMjMxMTAwMzEwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac60bfae20ef4645dba93da5d65fb5b18dbd09590df2715718521af9495549de35
hovercard-subject-tagissue:4532397296
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/typeshed/15840/issue_layout
twitter:imagehttps://opengraph.githubassets.com/3491636a74e76dd500525e127e0ccb4b414e6e9876d982042526bf62f81cb51a/python/typeshed/issues/15840
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/3491636a74e76dd500525e127e0ccb4b414e6e9876d982042526bf62f81cb51a/python/typeshed/issues/15840
og:image:altProblem The current type annotation for Tk.report_callback_exception in typeshed, introduced in #2498, causes a regression when subclassing tkinter.Tk and overriding the method. Issue 1: Incompatib...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameJesse205
hostnamegithub.com
expected-hostnamegithub.com
None4eb4cba0d69f045374ac15de9666d22b0961e1d555cc3824f36b7734c00c78e0
turbo-cache-controlno-preview
go-importgithub.com/python/typeshed git https://github.com/python/typeshed.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id31696383
octolytics-dimension-repository_nwopython/typeshed
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id31696383
octolytics-dimension-repository_network_root_nwopython/typeshed
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release44c658b24abf00491fb7ae5f56d42c9f38cbeab2
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/python/typeshed/issues/15840#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Ftypeshed%2Fissues%2F15840
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Ftypeshed%2Fissues%2F15840
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=python%2Ftypeshed
Reloadhttps://github.com/python/typeshed/issues/15840
Reloadhttps://github.com/python/typeshed/issues/15840
Reloadhttps://github.com/python/typeshed/issues/15840
pythonhttps://github.com/python
typeshedhttps://github.com/python/typeshed
Codehttps://github.com/python/typeshed
Issues196 (196)https://github.com/python/typeshed/issues
Pull requests251 (251)https://github.com/python/typeshed/pulls
Actionshttps://github.com/python/typeshed/actions
Security and qualityhttps://github.com/python/typeshed/security
Insightshttps://github.com/python/typeshed/insights
https://github.com/python/typeshed
New issuehttps://github.com/login?return_to=https://github.com/python/typeshed/issues/15840
New issuehttps://github.com/login?return_to=https://github.com/python/typeshed/issues/15840
Tk.report_callback_exception type annotation breaks subclass override compatibilityhttps://github.com/python/typeshed/issues/15840#top
https://github.com/Jesse205
Jesse205https://github.com/Jesse205
on May 27, 2026https://github.com/python/typeshed/issues/15840#issue-4532397296
#2498https://github.com/python/typeshed/pull/2498
#1767 (comment)https://github.com/python/typeshed/issues/1767#issuecomment-680798604
intentionalhttps://mypy.readthedocs.io/en/stable/error_code_list.html#check-that-assignment-target-is-not-a-method-method-assign
#1767https://github.com/python/typeshed/issues/1767
https://github.com/JelleZijlstra
JelleZijlstrahttps://github.com/JelleZijlstra
on May 27, 2026https://github.com/python/typeshed/issues/15840#issuecomment-4554913304
https://github.com/Jesse205
Jesse205https://github.com/Jesse205
on May 28, 2026https://github.com/python/typeshed/issues/15840#issuecomment-4560348970
https://pythonguides.com/exception-in-tkinter-callback-python/https://pythonguides.com/exception-in-tkinter-callback-python/
https://stackoverflow.com/questions/38464351https://stackoverflow.com/questions/38464351
https://github.com/search?q=report_callback_exception&type=codehttps://github.com/search?q=report_callback_exception&type=code
https://github.com/Akuli
Akulihttps://github.com/Akuli
on May 30, 2026https://github.com/python/typeshed/issues/15840#issuecomment-4582063048
https://github.com/Akuli
Akulihttps://github.com/Akuli
on May 30, 2026https://github.com/python/typeshed/issues/15840#issuecomment-4582628075
https://github.com/Jesse205
Jesse205https://github.com/Jesse205
on May 30, 2026https://github.com/python/typeshed/issues/15840#issuecomment-4582857068
#15842https://github.com/python/typeshed/pull/15842
Jesse205https://github.com/Jesse205
not plannedhttps://github.com/python/typeshed/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Anot-planned
on May 30, 2026https://github.com/python/typeshed/issues/15840#event-26141701886
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/typeshed/issues/15840
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/typeshed/issues/15840
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.