René's URL Explorer Experiment


Title: Cannot silence "unused 'type: ignore'" in version specific code · Issue #8823 · python/mypy · GitHub

Open Graph Title: Cannot silence "unused 'type: ignore'" in version specific code · Issue #8823 · python/mypy

X Title: Cannot silence "unused 'type: ignore'" in version specific code · Issue #8823 · python/mypy

Description: I need to execute some code only on specific Python version (it is the use of TextIOWrapper.reconfigure() added in Python 3.7, but in following example I will use more abstract code). import sys if sys.version_info >= (3, 7): x: int = 'a...

Open Graph Description: I need to execute some code only on specific Python version (it is the use of TextIOWrapper.reconfigure() added in Python 3.7, but in following example I will use more abstract code). import sys if...

X Description: I need to execute some code only on specific Python version (it is the use of TextIOWrapper.reconfigure() added in Python 3.7, but in following example I will use more abstract code). import sys if...

Opengraph URL: https://github.com/python/mypy/issues/8823

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Cannot silence \"unused 'type: ignore'\" in version specific code","articleBody":"I need to execute some code only on specific Python version (it is the use of `TextIOWrapper.reconfigure()` added in Python 3.7, but in following example I will use more abstract code).\r\n```python\r\nimport sys\r\n\r\nif sys.version_info >= (3, 7):\r\n    x: int = 'a'\r\n```\r\nSince MyPy on Python 3.7 raises an error for it (actually because of the error in `typeshed`) I need to add `# type: ignore`:\r\n```python\r\nimport sys\r\n\r\nif sys.version_info >= (3, 7):\r\n    x: int = 'a'  # type: ignore\r\n```\r\nBut now I will get an error `unused 'type: ignore' comment` when run MyPy with `warn_unused_ignores = True` on Python 3.6.\r\n\r\nSo I cannot use variant 1, because it is an error on 3.7, and cannot use variant 2, because it is an error on 3.6.\r\n\r\nMyPy should not complain about unused 'type: ignore' comment in the code which it does not analyze.\r\n\r\nMyPy version is 0.770.","author":{"url":"https://github.com/serhiy-storchaka","@type":"Person","name":"serhiy-storchaka"},"datePublished":"2020-05-14T13:49:25Z","url":"https://github.com/python/mypy/issues/8823"}

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:f83ecccd-7b70-caa7-4a70-5a3dd8860082
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idB0D2:3F7946:10D3D90:16939E0:6AFFC7C1
html-safe-nonce01ca9ad88a7ecc68fc88846524a9688d18a4e8b23699c6e9422cca67ba610ed6
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMEQyOjNGNzk0NjoxMEQzRDkwOjE2OTM5RTA6NkFGRkM3QzEiLCJ2aXNpdG9yX2lkIjoiNTcwMzk2NzMxMTA3Mzg4ODE5MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac5aa060173628de4ac09f41a81b7f4981a1629021d64e08dbe8b05429a36354a0
hovercard-subject-tagissue:618247700
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/mypy/8823/issue_layout
twitter:imagehttps://opengraph.githubassets.com/e746f747058796ffbde5612396afae69e8681584edb27936fa344fbad253b77d/python/mypy/issues/8823
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/e746f747058796ffbde5612396afae69e8681584edb27936fa344fbad253b77d/python/mypy/issues/8823
og:image:altI need to execute some code only on specific Python version (it is the use of TextIOWrapper.reconfigure() added in Python 3.7, but in following example I will use more abstract code). import sys if...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameserhiy-storchaka
hostnamegithub.com
expected-hostnamegithub.com
None1e805b832df235bb21305db712c3b6432920019dfc12cb25b9cb8d3b0c9403cf
turbo-cache-controlno-preview
go-importgithub.com/python/mypy git https://github.com/python/mypy.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id7053637
octolytics-dimension-repository_nwopython/mypy
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id7053637
octolytics-dimension-repository_network_root_nwopython/mypy
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
release8fa4a54e6871c7908eda1c246ad5972982c0b59d
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/python/mypy/issues/8823#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fmypy%2Fissues%2F8823
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%2Fmypy%2Fissues%2F8823
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%2Fmypy
Reloadhttps://github.com/python/mypy/issues/8823
Reloadhttps://github.com/python/mypy/issues/8823
Reloadhttps://github.com/python/mypy/issues/8823
pythonhttps://github.com/python
mypyhttps://github.com/python/mypy
Codehttps://github.com/python/mypy
Issues2.7k (2.7k)https://github.com/python/mypy/issues
Pull requests547 (547)https://github.com/python/mypy/pulls
Actionshttps://github.com/python/mypy/actions
Projectshttps://github.com/python/mypy/projects
Wikihttps://github.com/python/mypy/wiki
Security and qualityhttps://github.com/python/mypy/security
Insightshttps://github.com/python/mypy/insights
https://github.com/python/mypy
New issuehttps://github.com/login?return_to=https://github.com/python/mypy/issues/8823
New issuehttps://github.com/login?return_to=https://github.com/python/mypy/issues/8823
#15164https://github.com/python/mypy/pull/15164
Cannot silence "unused 'type: ignore'" in version specific codehttps://github.com/python/mypy/issues/8823#top
#15164https://github.com/python/mypy/pull/15164
bugmypy got something wronghttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22bug%22
needs discussionhttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22needs%20discussion%22
priority-1-normalhttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22priority-1-normal%22
topic-reachabilityDetecting unreachable codehttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22topic-reachability%22
topic-type-ignore# type: ignore commentshttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22topic-type-ignore%22
https://github.com/serhiy-storchaka
serhiy-storchakahttps://github.com/serhiy-storchaka
on May 14, 2020https://github.com/python/mypy/issues/8823#issue-618247700
Nexthttps://github.com/python/mypy/issues/8823?timeline_page=1
https://github.com/hauntsaninja
hauntsaninjahttps://github.com/hauntsaninja
on May 14, 2020https://github.com/python/mypy/issues/8823#issuecomment-628846674
emmatypinghttps://github.com/emmatyping
bugmypy got something wronghttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22bug%22
needs discussionhttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22needs%20discussion%22
priority-1-normalhttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22priority-1-normal%22
on May 14, 2020https://github.com/python/mypy/issues/8823#event-3338739563
https://github.com/serhiy-storchaka
serhiy-storchakahttps://github.com/serhiy-storchaka
on May 18, 2020https://github.com/python/mypy/issues/8823#issuecomment-630002955
https://github.com/hauntsaninja
hauntsaninjahttps://github.com/hauntsaninja
on May 18, 2020https://github.com/python/mypy/issues/8823#issuecomment-630402302
https://github.com/serhiy-storchaka
serhiy-storchakahttps://github.com/serhiy-storchaka
on May 19, 2020https://github.com/python/mypy/issues/8823#issuecomment-630891881
https://github.com/serhiy-storchaka
serhiy-storchakahttps://github.com/serhiy-storchaka
on May 19, 2020https://github.com/python/mypy/issues/8823#issuecomment-630896957
https://github.com/msullivan
msullivanhttps://github.com/msullivan
on May 20, 2020https://github.com/python/mypy/issues/8823#issuecomment-631186324
msullivanhttps://github.com/msullivan
on May 20, 2020https://github.com/python/mypy/issues/8823#event-3354373537
https://github.com/wsanchez
wsanchezhttps://github.com/wsanchez
on Oct 1, 2020https://github.com/python/mypy/issues/8823#issuecomment-702422255
https://github.com/wsanchez
wsanchezhttps://github.com/wsanchez
on Oct 1, 2020https://github.com/python/mypy/issues/8823#issuecomment-702422691
https://github.com/gvanrossum
gvanrossumhttps://github.com/gvanrossum
on Oct 1, 2020https://github.com/python/mypy/issues/8823#issuecomment-702424423
@wsanchezhttps://github.com/wsanchez
https://github.com/wsanchez
wsanchezhttps://github.com/wsanchez
on Oct 1, 2020https://github.com/python/mypy/issues/8823#issuecomment-702425667
@gvanrossumhttps://github.com/gvanrossum
twisted/twisted#1416 (comment)https://github.com/twisted/twisted/pull/1416#issuecomment-702425277
dvarrazzohttps://github.com/dvarrazzo
on Oct 27, 2020https://github.com/python/mypy/issues/8823#event-3927697852
Work around the mypy method assignment false positive without `ignore`https://github.com/psycopg/psycopg/commit/6d43bd96ec0982aaa88cec097e44188a2702ca45
6d43bd9https://github.com/psycopg/psycopg/commit/6d43bd96ec0982aaa88cec097e44188a2702ca45
tonyhttps://github.com/tony
on Sep 8, 2022https://github.com/python/mypy/issues/8823#event-7343331230
ci(mypy): warn_unused_ignores = Truehttps://github.com/tony/pytest-sphinx/commit/d44ec2f2b5b9c6ba943d8f32f2904d7d0a81a4b2
d44ec2fhttps://github.com/tony/pytest-sphinx/commit/d44ec2f2b5b9c6ba943d8f32f2904d7d0a81a4b2
twmrhttps://github.com/twmr
on Sep 8, 2022https://github.com/python/mypy/issues/8823#event-7344303799
ci(mypy): warn_unused_ignores = Truehttps://github.com/twmr/pytest-sphinx/commit/ef5cdfae69c41bcc3c89addcf6229a68bb9d627b
ef5cdfahttps://github.com/twmr/pytest-sphinx/commit/ef5cdfae69c41bcc3c89addcf6229a68bb9d627b
AlexWaygoodhttps://github.com/AlexWaygood
topic-reachabilityDetecting unreachable codehttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22topic-reachability%22
on Dec 28, 2022https://github.com/python/mypy/issues/8823#event-8122494327
m-k-l-shttps://github.com/m-k-l-s
on Jan 5, 2023https://github.com/python/mypy/issues/8823#event-8162382224
fix: mypy unused ignore, python/mypy#8823https://github.com/m-k-l-s/searchlauncher/commit/2a1ef0b79e50894dc282a9603b1b3f730e87e17b
python/mypy#8823https://github.com/python/mypy/issues/8823
2a1ef0bhttps://github.com/m-k-l-s/searchlauncher/commit/2a1ef0b79e50894dc282a9603b1b3f730e87e17b
https://github.com/senarvi
senarvihttps://github.com/senarvi
on Mar 17, 2023https://github.com/python/mypy/issues/8823#issuecomment-1474221605
@stinovlashttps://github.com/stinovlas
https://github.com/matteosantama
matteosantamahttps://github.com/matteosantama
on Mar 26, 2023https://github.com/python/mypy/issues/8823#issuecomment-1484253580
https://github.com/hauntsaninja
hauntsaninjahttps://github.com/hauntsaninja
on Mar 27, 2023https://github.com/python/mypy/issues/8823#issuecomment-1484368501
ssbarneahttps://github.com/ssbarnea
on May 2, 2023https://github.com/python/mypy/issues/8823#event-9146136556
Make mypy execution more reproduciblehttps://github.com/ansible/ansible-lint/commit/0f5e897d2684416f0c35245d36129ee898e6430c
0f5e897https://github.com/ansible/ansible-lint/commit/0f5e897d2684416f0c35245d36129ee898e6430c
ilevkivskyihttps://github.com/ilevkivskyi
completedhttps://github.com/python/mypy/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#15164https://github.com/python/mypy/pull/15164
on May 2, 2023https://github.com/python/mypy/issues/8823#event-9147246872
ilevkivskyihttps://github.com/ilevkivskyi
on May 2, 2023https://github.com/python/mypy/issues/8823#event-9147247027
Do not show unused-ignore errors in unreachable code, and make it a r…https://github.com/python/mypy/commit/61f6358306e82b2560bd98f376e1457c8ce4227b
https://docs.github.com/articles/closing-issues-via-commit-messages
61f6358https://github.com/python/mypy/commit/61f6358306e82b2560bd98f376e1457c8ce4227b
https://github.com/hauntsaninja
hauntsaninjahttps://github.com/hauntsaninja
on May 21, 2023https://github.com/python/mypy/issues/8823#issuecomment-1556288015
spoorcchttps://github.com/spoorcc
on Nov 15, 2023https://github.com/python/mypy/issues/8823#event-10969756116
Use solution for unused-ignorehttps://github.com/dfetch-org/dfetch/commit/1b431214095d8eda4f8b8862b7bd3a0ca729322a
1b43121https://github.com/dfetch-org/dfetch/commit/1b431214095d8eda4f8b8862b7bd3a0ca729322a
ben-ednahttps://github.com/ben-edna
on Nov 15, 2023https://github.com/python/mypy/issues/8823#event-10969800590
Use solution for unused-ignorehttps://github.com/dfetch-org/dfetch/commit/aae355535b343d350c4044635feefd41e0a0acf6
aae3555https://github.com/dfetch-org/dfetch/commit/aae355535b343d350c4044635feefd41e0a0acf6
axiomofjoyhttps://github.com/axiomofjoy
on May 14, 2024https://github.com/python/mypy/issues/8823#event-12807942275
ci: ensure type ignores in langchain tests run across all versions of…https://github.com/Arize-ai/openinference/commit/3aa9ef6147ea77fdccf87841f3a0e20a7407f527
3aa9ef6https://github.com/Arize-ai/openinference/commit/3aa9ef6147ea77fdccf87841f3a0e20a7407f527
GeLi2001https://github.com/GeLi2001
on May 28, 2025https://github.com/python/mypy/issues/8823#event-17855500413
ci: ensure type ignores in langchain tests run across all versions of…https://github.com/Arize-ai/openinference/commit/abb2e7541cad9373ef11138f120d17086ecf6e1e
abb2e75https://github.com/Arize-ai/openinference/commit/abb2e7541cad9373ef11138f120d17086ecf6e1e
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/mypy/issues/8823
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/mypy/issues/8823
bugmypy got something wronghttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22bug%22
needs discussionhttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22needs%20discussion%22
priority-1-normalhttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22priority-1-normal%22
topic-reachabilityDetecting unreachable codehttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22topic-reachability%22
topic-type-ignore# type: ignore commentshttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22topic-type-ignore%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.