Title: Recent change to `tuple` constructor breaks subclasses of tuples · Issue #8275 · python/typeshed · GitHub
Open Graph Title: Recent change to `tuple` constructor breaks subclasses of tuples · Issue #8275 · python/typeshed
X Title: Recent change to `tuple` constructor breaks subclasses of tuples · Issue #8275 · python/typeshed
Description: A recent change to the tuple.__new__ method in builtins.pyi introduced an overload: @overload def __new__(cls) -> tuple[()]: ... This overload is problematic for classes that derive from specialized tuples. class MyTuple(tuple[int, str, ...
Open Graph Description: A recent change to the tuple.__new__ method in builtins.pyi introduced an overload: @overload def __new__(cls) -> tuple[()]: ... This overload is problematic for classes that derive from specialize...
X Description: A recent change to the tuple.__new__ method in builtins.pyi introduced an overload: @overload def __new__(cls) -> tuple[()]: ... This overload is problematic for classes that derive from special...
Opengraph URL: https://github.com/python/typeshed/issues/8275
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Recent change to `tuple` constructor breaks subclasses of tuples","articleBody":"A recent change to the `tuple.__new__` method in `builtins.pyi` introduced an overload:\r\n```python\r\n @overload\r\n def __new__(cls) -\u003e tuple[()]: ...\r\n```\r\n\r\nThis overload is problematic for classes that derive from specialized tuples.\r\n\r\n```python\r\nclass MyTuple(tuple[int, str, str]):\r\n ...\r\n\r\nx = MyTuple()\r\nreveal_type(x) # tuple[()] !!!!\r\n```\r\n\r\nBecause of this overload, the wrong type is evaluated.\r\n\r\nI think this overload should return `Self`, not `tuple[()]`. Admittedly, that doesn't produce the ideal type evaluation for `tuple()`. It produces `tuple[Any, ...]` rather than `tuple[()]`.","author":{"url":"https://github.com/erictraut","@type":"Person","name":"erictraut"},"datePublished":"2022-07-12T08:48:56.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/8275/typeshed/issues/8275"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:1abe2c24-89af-00b7-48ab-bdedb7f49ec7 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A2D6:3F31A5:119889:17E844:6A6169B4 |
| html-safe-nonce | c1c400add93b645a0837b0ba1905376352f1d9a4daba4780e1d73ba477cca99c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMkQ2OjNGMzFBNToxMTk4ODk6MTdFODQ0OjZBNjE2OUI0IiwidmlzaXRvcl9pZCI6IjI4NjM0NjIzNzc0Mjk0OTQxOTYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 626fb0d42441d5fe379c2c8e974dad8a1015002026e88e320133159648b4be60 |
| hovercard-subject-tag | issue:1301747855 |
| github-keyboard-shortcuts | repository,issues,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/_view_fragments/issues/show/python/typeshed/8275/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f59d9044be5453474f58dd6b4a7f67cd3953d634d7daffafb692368c1df6cd85/python/typeshed/issues/8275 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f59d9044be5453474f58dd6b4a7f67cd3953d634d7daffafb692368c1df6cd85/python/typeshed/issues/8275 |
| og:image:alt | A recent change to the tuple.__new__ method in builtins.pyi introduced an overload: @overload def __new__(cls) -> tuple[()]: ... This overload is problematic for classes that derive from specialize... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | erictraut |
| hostname | github.com |
| expected-hostname | github.com |
| None | a69385f7d268ece7ad25b131bbd70f457024811fc79afcae43785a6849b724e2 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/typeshed git https://github.com/python/typeshed.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 31696383 |
| octolytics-dimension-repository_nwo | python/typeshed |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 31696383 |
| octolytics-dimension-repository_network_root_nwo | python/typeshed |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 484cf265a1f970d5c7a5e7c37cb677d8010aa12f |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width