René's URL Explorer Experiment


Title: AbstractContextManager.__enter__ not properly annotated · Issue #13950 · python/typeshed · GitHub

Open Graph Title: AbstractContextManager.__enter__ not properly annotated · Issue #13950 · python/typeshed

X Title: AbstractContextManager.__enter__ not properly annotated · Issue #13950 · python/typeshed

Description: Per the Python docs, AbstractContextManager provides a default __enter__ implementation which just returns self. But this does not appear to be properly type annotated (using Self): from typing import reveal_type, Optional, Self from typ...

Open Graph Description: Per the Python docs, AbstractContextManager provides a default __enter__ implementation which just returns self. But this does not appear to be properly type annotated (using Self): from typing imp...

X Description: Per the Python docs, AbstractContextManager provides a default __enter__ implementation which just returns self. But this does not appear to be properly type annotated (using Self): from typing imp...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"AbstractContextManager.__enter__ not properly annotated","articleBody":"Per the Python docs, `AbstractContextManager` provides a default `__enter__` implementation which just returns `self`. But this does not appear to be properly type annotated (using `Self`):\n\n```python\nfrom typing import reveal_type, Optional, Self\nfrom types import TracebackType\nfrom contextlib import AbstractContextManager\n\nclass A1(AbstractContextManager):\n    def __exit__(  # pylint: disable=useless-return\n            self, exc_type: Optional[type[BaseException]],\n            exc_val: Optional[BaseException],\n            exc_tb: Optional[TracebackType]) -> Optional[bool]:\n        return None\n\nclass A2(AbstractContextManager):\n    def __exit__(  # pylint: disable=useless-return\n            self, exc_type: Optional[type[BaseException]],\n            exc_val: Optional[BaseException],\n            exc_tb: Optional[TracebackType]) -> Optional[bool]:\n        return None\n\n    def __enter__(self) -> Self:\n        return self\n\nclass B1(A1):\n    pass\n\nclass B2(A2):\n    pass\n\nwith B1() as d1:\n    reveal_type(d1)\n\nwith B2() as d2:\n    reveal_type(d2)\n```\n\n[Running this with `mypy`](https://mypy-play.net/?mypy=latest&python=3.13&gist=e9e6697dc12768b01b56f785f0827b72), only the second case properly reveals the type as `B2`. The first one just says `Any`.\n\nAt runtime, the behavior of both is identical.\n\nI have recreated this on both Python 3.12 and Python 3.13.","author":{"url":"https://github.com/mharding-hpe","@type":"Person","name":"mharding-hpe"},"datePublished":"2025-05-05T21:14:43Z","url":"https://github.com/python/typeshed/issues/13950"}

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:0a102af9-b1fc-d26e-35a0-703d8b96761d
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id8B60:374654:8B0E5:B494F:6AFF8D7B
html-safe-nonce466d23eb7d6ffe85b6fee751deacc1632efca5cbb93f6d32433ebdf8bdab8630
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QjYwOjM3NDY1NDo4QjBFNTpCNDk0Rjo2QUZGOEQ3QiIsInZpc2l0b3JfaWQiOiI4Njg2MzkzNzY1MzUyNDEwNDkxIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac97784c6d90ecb3682c5bc62516b2cb9e5a7a44841fabfdd316ff7eeb6b755e62
hovercard-subject-tagissue:3041696049
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/13950/issue_layout
twitter:imagehttps://opengraph.githubassets.com/840c087f476b533578dfb911acc5ba09fc3bec5f19e6e7b80b50b475ef1c8ee2/python/typeshed/issues/13950
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/840c087f476b533578dfb911acc5ba09fc3bec5f19e6e7b80b50b475ef1c8ee2/python/typeshed/issues/13950
og:image:altPer the Python docs, AbstractContextManager provides a default __enter__ implementation which just returns self. But this does not appear to be properly type annotated (using Self): from typing imp...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamemharding-hpe
hostnamegithub.com
expected-hostnamegithub.com
None587ad99a3e443b2e1cb0d3df059ec49ab54389861f13310766dfdeb615fed90d
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
release5bb0fb68d64881d1344f5863d809515d496801e5
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/python/typeshed/issues/13950#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Ftypeshed%2Fissues%2F13950
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%2F13950
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/13950
Reloadhttps://github.com/python/typeshed/issues/13950
Reloadhttps://github.com/python/typeshed/issues/13950
pythonhttps://github.com/python
typeshedhttps://github.com/python/typeshed
Codehttps://github.com/python/typeshed
Issues196 (196)https://github.com/python/typeshed/issues
Pull requests249 (249)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/13950
New issuehttps://github.com/login?return_to=https://github.com/python/typeshed/issues/13950
AbstractContextManager.__enter__ not properly annotatedhttps://github.com/python/typeshed/issues/13950#top
reason: inexpressibleClosed, because this can't be expressed within the current type systemhttps://github.com/python/typeshed/issues?q=state%3Aopen%20label%3A%22reason%3A%20inexpressible%22
stubs: false negativeType checkers do not report an error, but shouldhttps://github.com/python/typeshed/issues?q=state%3Aopen%20label%3A%22stubs%3A%20false%20negative%22
https://github.com/mharding-hpe
mharding-hpehttps://github.com/mharding-hpe
on May 5, 2025https://github.com/python/typeshed/issues/13950#issue-3041696049
Running this with mypyhttps://mypy-play.net/?mypy=latest&python=3.13&gist=e9e6697dc12768b01b56f785f0827b72
srittauhttps://github.com/srittau
python/typinghttps://github.com/python/typing
on May 6, 2025https://github.com/python/typeshed/issues/13950#event-17531344538
srittauhttps://github.com/srittau
stubs: false negativeType checkers do not report an error, but shouldhttps://github.com/python/typeshed/issues?q=state%3Aopen%20label%3A%22stubs%3A%20false%20negative%22
on May 6, 2025https://github.com/python/typeshed/issues/13950#event-17531362596
https://github.com/srittau
srittauhttps://github.com/srittau
on May 6, 2025https://github.com/python/typeshed/issues/13950#issuecomment-2853457653
https://github.com/srittau
srittauhttps://github.com/srittau
on May 6, 2025https://github.com/python/typeshed/issues/13950#issuecomment-2854235139
#13951https://github.com/python/typeshed/pull/13951
a discussion on discuss.python.orghttps://discuss.python.org/t/self-as-typevar-default/90939
https://github.com/mharding-hpe
mharding-hpehttps://github.com/mharding-hpe
on May 6, 2025https://github.com/python/typeshed/issues/13950#issuecomment-2854418547
srittauhttps://github.com/srittau
reason: inexpressibleClosed, because this can't be expressed within the current type systemhttps://github.com/python/typeshed/issues?q=state%3Aopen%20label%3A%22reason%3A%20inexpressible%22
on May 11, 2025https://github.com/python/typeshed/issues/13950#event-17605564110
https://github.com/srittau
srittauhttps://github.com/srittau
on May 11, 2025https://github.com/python/typeshed/issues/13950#issuecomment-2869834624
srittauhttps://github.com/srittau
not plannedhttps://github.com/python/typeshed/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Anot-planned
on May 11, 2025https://github.com/python/typeshed/issues/13950#event-17605566874
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/typeshed/issues/13950
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/typeshed/issues/13950
reason: inexpressibleClosed, because this can't be expressed within the current type systemhttps://github.com/python/typeshed/issues?q=state%3Aopen%20label%3A%22reason%3A%20inexpressible%22
stubs: false negativeType checkers do not report an error, but shouldhttps://github.com/python/typeshed/issues?q=state%3Aopen%20label%3A%22stubs%3A%20false%20negative%22
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.