René's URL Explorer Experiment


Title: gh-87390: Add tests demonstrating current type variable substitution behaviour by mrahtz · Pull Request #32341 · python/cpython · GitHub

Open Graph Title: gh-87390: Add tests demonstrating current type variable substitution behaviour by mrahtz · Pull Request #32341 · python/cpython

X Title: gh-87390: Add tests demonstrating current type variable substitution behaviour by mrahtz · Pull Request #32341 · python/cpython

Description: Here's a reference of what we currently do and don't allow in terms of type variable substitution in aliases. I've marked the cases that I think the current implementation is incorrect on. Ideally I'd like to merge this as-is, even with the test cases whose expected results aren't what we think they should be - I think it'll make our job implementing the remaining fixes easier if we can just twiddle one line of an existing test case rather than having to remember to copy-paste the test case that each change fixes. Some cases I'm unsure about are: tuple[T][*tuple[int, ...]]. My understanding is that when it comes to tuple[int, ...], the current behaviour of type checkers is to "Try to find a way to make it work" - I think this should be tuple[int]? class C(Generic[T1, T2]): ...; C[*tuple[int, ...], *tuple[str, ...]]. By similar reasoning, this should work - but should it be C[int, int], C[int, str], or C[str, str]? @pradeep90 What do you think? https://bugs.python.org/issue47006

Open Graph Description: Here's a reference of what we currently do and don't allow in terms of type variable substitution in aliases. I've marked the cases that I think the current implementation is incorrect ...

X Description: Here's a reference of what we currently do and don't allow in terms of type variable substitution in aliases. I've marked the cases that I think the current implementation i...

Opengraph URL: https://github.com/python/cpython/pull/32341

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:5f76f44e-5648-09b9-f574-1378b02e6e81
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idE3FE:F40F2:3114DE:41B942:6969CE40
html-safe-nonce8a36df3528a52994f963cf8f8b52b705e8174a2d100e82e2490c05627530f8e7
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFM0ZFOkY0MEYyOjMxMTRERTo0MUI5NDI6Njk2OUNFNDAiLCJ2aXNpdG9yX2lkIjoiMjc2MjU4NTQyMzk3MDE2MDE5MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac62d2e273edb5a4f112cd89e4b12626ff773338360fde24cd223efb2e2abf3611
hovercard-subject-tagpull_request:900665331
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/python/cpython/pull/32341/files
twitter:imagehttps://avatars.githubusercontent.com/u/4431336?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/4431336?s=400&v=4
og:image:altHere's a reference of what we currently do and don't allow in terms of type variable substitution in aliases. I've marked the cases that I think the current implementation is incorrect ...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Noneacedec8b5f975d9e3d494ddd8f949b0b8a0de59d393901e26f73df9dcba80056
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/python/cpython git https://github.com/python/cpython.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id81598961
octolytics-dimension-repository_nwopython/cpython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id81598961
octolytics-dimension-repository_network_root_nwopython/cpython
turbo-body-classeslogged-out env-production page-responsive
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release83c08c21cdda978090dc44364b71aa5bc6dcea79
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/pull/32341/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F32341%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
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
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://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/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F32341%2Ffiles
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=python%2Fcpython
Reloadhttps://github.com/python/cpython/pull/32341/files
Reloadhttps://github.com/python/cpython/pull/32341/files
Reloadhttps://github.com/python/cpython/pull/32341/files
python https://github.com/python
cpythonhttps://github.com/python/cpython
Please reload this pagehttps://github.com/python/cpython/pull/32341/files
Notifications https://github.com/login?return_to=%2Fpython%2Fcpython
Fork 33.9k https://github.com/login?return_to=%2Fpython%2Fcpython
Star 71.1k https://github.com/login?return_to=%2Fpython%2Fcpython
Code https://github.com/python/cpython
Issues 5k+ https://github.com/python/cpython/issues
Pull requests 2.1k https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects 31 https://github.com/python/cpython/projects
Security Uh oh! There was an error while loading. Please reload this page. https://github.com/python/cpython/security
Please reload this pagehttps://github.com/python/cpython/pull/32341/files
Insights https://github.com/python/cpython/pulse
Code https://github.com/python/cpython
Issues https://github.com/python/cpython/issues
Pull requests https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects https://github.com/python/cpython/projects
Security https://github.com/python/cpython/security
Insights https://github.com/python/cpython/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fpython%2Fcpython%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fpython%2Fcpython%2Fissues%2Fnew%2Fchoose
JelleZijlstrahttps://github.com/JelleZijlstra
python:mainhttps://github.com/python/cpython/tree/main
mrahtz:subst-testshttps://github.com/mrahtz/cpython/tree/subst-tests
Conversation 42 https://github.com/python/cpython/pull/32341
Commits 24 https://github.com/python/cpython/pull/32341/commits
Checks 0 https://github.com/python/cpython/pull/32341/checks
Files changed https://github.com/python/cpython/pull/32341/files
Please reload this pagehttps://github.com/python/cpython/pull/32341/files
gh-87390: Add tests demonstrating current type variable substitution behaviour https://github.com/python/cpython/pull/32341/files#top
Show all changes 24 commits https://github.com/python/cpython/pull/32341/files
f508d12 Add integration tests for type variable substitution mrahtz Apr 5, 2022 https://github.com/python/cpython/pull/32341/commits/f508d12ea51855a6eedbbb28a2d55c7a9a3b904f
ea104b9 Add tests for list, dict and tuple mrahtz Apr 8, 2022 https://github.com/python/cpython/pull/32341/commits/ea104b97a8198bd26e85ea62f383be1c8fae99cf
526d9e8 Add tests for Tuple mrahtz Apr 9, 2022 https://github.com/python/cpython/pull/32341/commits/526d9e8995ff4da08fd4e2d8c43fc0c39deef593
0f022db Revert "Add tests for Tuple" mrahtz Apr 9, 2022 https://github.com/python/cpython/pull/32341/commits/0f022db57132dc6cec9318768250f27640d4d941
cc7bf8c Make it easier to tests all tuple, list and dict types mrahtz Apr 10, 2022 https://github.com/python/cpython/pull/32341/commits/cc7bf8cc6540f1964dd04ae28f1fb0d6806df781
458b5dd TypeVarSubstitutionTests -> GenericAliasSubstitutionTests mrahtz Apr 10, 2022 https://github.com/python/cpython/pull/32341/commits/458b5ddbbb96301496113a7a8aceca4d7116cbf8
0c8ba38 Remove question marks from cases I'm actually pretty sure about mrahtz Apr 10, 2022 https://github.com/python/cpython/pull/32341/commits/0c8ba383d83731e03ad9569daec84570d4f57d0f
db24e70 Note that list[] should only take one argument mrahtz Apr 11, 2022 https://github.com/python/cpython/pull/32341/commits/db24e70cd086bc0ca65d59cc7e014466ebbd9fc7
15a4809 Leave unpacked tuples unsimplified mrahtz Apr 11, 2022 https://github.com/python/cpython/pull/32341/commits/15a48099849ea0367e5949c2e5a93a6643772695
0d7d2eb Add generic[*Ts][*tuple[*Ts]] mrahtz Apr 11, 2022 https://github.com/python/cpython/pull/32341/commits/0d7d2eb5e6860d61c1e9741fb34e491b212facfb
ab01c8a Update comments based on decision to leave unpacked tuples unsimplified mrahtz Apr 11, 2022 https://github.com/python/cpython/pull/32341/commits/ab01c8a8c24c31f04a8c70242ef374bca23374e7
c4fe922 Add tests for generic[T1, bool, T2][*tuple[int, str]] mrahtz Apr 15, 2022 https://github.com/python/cpython/pull/32341/commits/c4fe922c4e2f301a84e74ca02ec979fa3e47cc0c
d55b8fb Update comments based on decision to unpack *some* tuples mrahtz Apr 15, 2022 https://github.com/python/cpython/pull/32341/commits/d55b8fb02cfd203085ac306936d783faa41080f8
e858fc6 Note that generic[*tuple[()]] should raise TypeError mrahtz Apr 16, 2022 https://github.com/python/cpython/pull/32341/commits/e858fc6af418027f850a505333dd88f1751ff75d
3bc7d26 Note that C[T, *tuple[int, ...]][int] raises TypeError only because C… mrahtz Apr 16, 2022 https://github.com/python/cpython/pull/32341/commits/3bc7d262192bb23bfba50f97011cc1bca8aab71b
c980e4f State that multiple unpackings should be allowed where possible mrahtz Apr 16, 2022 https://github.com/python/cpython/pull/32341/commits/c980e4f1e85eea9f4c107534fc0efd92a579985f
95b7210 Add test for generic[T1, *tuple[int, ...], T2][str, bool, float] mrahtz Apr 16, 2022 https://github.com/python/cpython/pull/32341/commits/95b721074524f89b6e136f9d728ac22410a1e303
96394b1 Update comments according to revised tentative spec at https://github… mrahtz Apr 16, 2022 https://github.com/python/cpython/pull/32341/commits/96394b1f86b13fb82ee07a953f2669560f037ecd
ed9a557 Update expected comments to account for unpacked types only being val… mrahtz Apr 18, 2022 https://github.com/python/cpython/pull/32341/commits/ed9a5576d86d24ebd8502b2d10d1b17ff63c6064
faa9fc3 Merge branch 'main' into subst-tests mrahtz Apr 18, 2022 https://github.com/python/cpython/pull/32341/commits/faa9fc3b80fcc25c184c06a2b5faceaeb241e0d8
9947fc0 Update to reflect results after merging latest main mrahtz Apr 18, 2022 https://github.com/python/cpython/pull/32341/commits/9947fc073b9d9a16f7d5cecba0794214ea737179
12496fc Update ALL tests to reflect results after merging latest main mrahtz Apr 18, 2022 https://github.com/python/cpython/pull/32341/commits/12496fc0ec0b1adb3030d3f89b054f3e50697040
db9af53 Remove comments saying we should get a TypeError in cases where we *d… mrahtz Apr 18, 2022 https://github.com/python/cpython/pull/32341/commits/db9af53d38f31961ac7d97bb174a35a77d5d274e
c5b5a63 Update comments on expected results based on latest tentative spec at… mrahtz Apr 29, 2022 https://github.com/python/cpython/pull/32341/commits/c5b5a63585f5e0cd656ddafd1ff00fd25eded010
Clear filters https://github.com/python/cpython/pull/32341/files
Please reload this pagehttps://github.com/python/cpython/pull/32341/files
Please reload this pagehttps://github.com/python/cpython/pull/32341/files
Please reload this pagehttps://github.com/python/cpython/pull/32341/files
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.