Title: bpo-43224: Work around substitution of unpacked TypeVarTuple by mrahtz · Pull Request #31804 · python/cpython · GitHub
Open Graph Title: bpo-43224: Work around substitution of unpacked TypeVarTuple by mrahtz · Pull Request #31804 · python/cpython
X Title: bpo-43224: Work around substitution of unpacked TypeVarTuple by mrahtz · Pull Request #31804 · python/cpython
Description: Following up on the discussion in #31021 about how to handle substitution of TypeVarTuples, here's a first attempt at the solution Jelle suggested: when TypeVarTuples` are involved, don't perform the substitution at all, instead returning an object whose repr() reflects that. (What Jelle actually suggested was to return a new _GenericAlias here. I've tested that too, and it seems to work fine, but I'm a bit wary about giving _GenericAlias too many hats to wear - as a newcomer to this codebase, I've struggled with how overloaded classes already are, making it predict what the effects of a change will be. Having said that, Jelle, I remember you mentioning you'd prefer to keep the number of classes in typing.py small, so if you think the tradeoff isn't worth it, I respect your judgement, and we can re-use _GenericAlias, coping with the extra functionality with extra documentation comments.) The main alternative I'm aware of is the logic we cut out in b9b1c80 - about 200 lines of logic, and another 100 lines of tests. @serhiy-storchaka also has a partial solution in #31800, which could also be an option - making the substitutions only when it's easy, and otherwise falling back to the approach in this PR. I've also pulled in @serhiy-storchaka's nice assertEndsWith helper from #31800 :) @JelleZijlstra @pradeep90 https://bugs.python.org/issue43224
Open Graph Description: Following up on the discussion in #31021 about how to handle substitution of TypeVarTuples, here's a first attempt at the solution Jelle suggested: when TypeVarTuples` are involved, don't p...
X Description: Following up on the discussion in #31021 about how to handle substitution of TypeVarTuples, here's a first attempt at the solution Jelle suggested: when TypeVarTuples` are involved, don&...
Opengraph URL: https://github.com/python/cpython/pull/31804
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:08762a1d-e270-be2c-0768-d65645afb0d9 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | A200:2E599F:A0C6BE:DD07A1:6969E809 |
| html-safe-nonce | 255eafe8c62454581963b1a5ddd75a7f3cbe88ee0182f2aa820cee2bd9880659 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMjAwOjJFNTk5RjpBMEM2QkU6REQwN0ExOjY5NjlFODA5IiwidmlzaXRvcl9pZCI6IjUyMjk4Mzc5MjEyNTczODM5NDUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 2cc153d136618d2f1a5b0a9ce3e6235046e5dd0a8ef6feb07cc819de61a78ce9 |
| hovercard-subject-tag | pull_request:876914911 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/python/cpython/pull/31804/files |
| twitter:image | https://avatars.githubusercontent.com/u/4431336?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/4431336?s=400&v=4 |
| og:image:alt | Following up on the discussion in #31021 about how to handle substitution of TypeVarTuples, here's a first attempt at the solution Jelle suggested: when TypeVarTuples` are involved, don't p... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7b32f1c7c4549428ee399213e8345494fc55b5637195d3fc5f493657579235e8 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | bdde15ad1b403e23b08bbd89b53fbe6bdf688cad |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width