Title: Also test `typing.NamedTuple` with `copy.replace` · Issue #109956 · python/cpython · GitHub
Open Graph Title: Also test `typing.NamedTuple` with `copy.replace` · Issue #109956 · python/cpython
X Title: Also test `typing.NamedTuple` with `copy.replace` · Issue #109956 · python/cpython
Description: Bug report Right now only collections.namedtuple is tested: cpython/Lib/test/test_copy.py Lines 937 to 946 in b1aebf1 def test_namedtuple(self): from collections import namedtuple Point = namedtuple('Point', 'x y', defaults=(0,)) p = Poi...
Open Graph Description: Bug report Right now only collections.namedtuple is tested: cpython/Lib/test/test_copy.py Lines 937 to 946 in b1aebf1 def test_namedtuple(self): from collections import namedtuple Point = namedtupl...
X Description: Bug report Right now only collections.namedtuple is tested: cpython/Lib/test/test_copy.py Lines 937 to 946 in b1aebf1 def test_namedtuple(self): from collections import namedtuple Point = namedtupl...
Opengraph URL: https://github.com/python/cpython/issues/109956
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Also test `typing.NamedTuple` with `copy.replace`","articleBody":"# Bug report\n\nRight now only `collections.namedtuple` is tested: https://github.com/python/cpython/blob/b1aebf1e6576680d606068d17e2208259573e061/Lib/test/test_copy.py#L937-L946\n\n@serhiy-storchaka noted in https://github.com/python/cpython/pull/108752#discussion_r1313369490 that only named tuples created by `collections.namedtuple()` are supported. But, since `typing.NamedTuple` uses `collections.namedtuple` inside: https://github.com/python/cpython/blob/b1aebf1e6576680d606068d17e2208259573e061/Lib/typing.py#L2695-L2696 it is also supported:\n\n```python\n>>> import typing\n>>> \n>>> class N(typing.NamedTuple):\n... x: int\n... y: int\n... \n>>> N.__replace__\n\u003cfunction N._replace at 0x10580a210>\n>>> import copy\n>>> copy.replace(N(1, 2), x=3)\nN(x=3, y=2)\n```\n\nI have a PR ready with extra tests.\n\nRefs https://github.com/python/cpython/issues/108751\nRefs https://github.com/python/cpython/pull/108752\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-109957\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/sobolevn","@type":"Person","name":"sobolevn"},"datePublished":"2023-09-27T09:48:58Z","url":"https://github.com/python/cpython/issues/109956"}
| react-profiling | 0 |
| react-import-map | react,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-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:4ea24553-3bcd-67fd-3335-08737ee48425 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8642:2FD3CB:CCE5ED:1135F50:6B005471 |
| html-safe-nonce | 97c4377597bd5294170ad095c115e71d571ffc021c7d6d52513dcb4f1ddcda69 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NjQyOjJGRDNDQjpDQ0U1RUQ6MTEzNUY1MDo2QjAwNTQ3MSIsInZpc2l0b3JfaWQiOiIyNjU3NjY2Mzc4MDQ3MTgxOTM3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 25eac4cbf47b713f671bd288461c6f689ad5030a3ed243658f2899052b96741d |
| hovercard-subject-tag | issue:1915119905 |
| 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/cpython/109956/issue_layout |
| twitter:image | https://opengraph.githubassets.com/22256b685d1dee08327849a09bbc1afe459dd17afe2bc428d9c63f6881717dc2/python/cpython/issues/109956 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/22256b685d1dee08327849a09bbc1afe459dd17afe2bc428d9c63f6881717dc2/python/cpython/issues/109956 |
| og:image:alt | Bug report Right now only collections.namedtuple is tested: cpython/Lib/test/test_copy.py Lines 937 to 946 in b1aebf1 def test_namedtuple(self): from collections import namedtuple Point = namedtupl... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | sobolevn |
| hostname | github.com |
| expected-hostname | github.com |
| None | f420f4996e6b1ff1ccd6d7683f8134f4b5f0f8a50124c210dbfe7490e5644abb |
| turbo-cache-control | no-preview |
| 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 |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 26e00df917aba0f128135dc073ea0c5e33a70d40 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width