Title: gh-145056: Add support for frozendict in dataclass asdict and astuple by eendebakpt · Pull Request #145125 · python/cpython · GitHub
Open Graph Title: gh-145056: Add support for frozendict in dataclass asdict and astuple by eendebakpt · Pull Request #145125 · python/cpython
X Title: gh-145056: Add support for frozendict in dataclass asdict and astuple by eendebakpt · Pull Request #145125 · python/cpython
Description: Adds support for frozendict in dataclassses.astype and dataclasses.asdict. The main effect is that astuple and asdict recurse into a frozendict (just like they recurse into a dict). For example from typing import Any from dataclasses import dataclass, astuple, asdict @dataclass class A: item : Any asub = A(item=10) a = A(item=frozendict({'sub': asub})) print(astuple(a)) Output on main: (frozendict({'sub': A(item=10)}),) Output on PR: (frozendict({'sub': (10,)}),) Notes: Tracking issue for PEP 814 is #141510 For exact dicts there is a fastpath (for performance reasons). In this PR we have not added a fastpath for the frozendict. If this turns out to be a common case, we can add the fastpath later. Issue: gh-145056 📚 Documentation preview 📚: https://cpython-previews--145125.org.readthedocs.build/
Open Graph Description: Adds support for frozendict in dataclassses.astype and dataclasses.asdict. The main effect is that astuple and asdict recurse into a frozendict (just like they recurse into a dict). For example fro...
X Description: Adds support for frozendict in dataclassses.astype and dataclasses.asdict. The main effect is that astuple and asdict recurse into a frozendict (just like they recurse into a dict). For example fro...
Opengraph URL: https://github.com/python/cpython/pull/145125
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:a56f37e2-cde5-e352-47b1-9ab73ff96de0 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | A872:177F6A:109E680:16875CB:6A507998 |
| html-safe-nonce | a5324517535bdee9a9828b0312975e8f7c87e2c561334eff17dac0d6f215f1e0 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBODcyOjE3N0Y2QToxMDlFNjgwOjE2ODc1Q0I6NkE1MDc5OTgiLCJ2aXNpdG9yX2lkIjoiMzUxODQ3NTIyMTEyNzQyODUwNCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | b41410a4463bcf50b5a253553c1731538fc0f1be823c0f8200988fc4945cc302 |
| hovercard-subject-tag | pull_request:3313493441 |
| 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/145125/files |
| twitter:image | https://avatars.githubusercontent.com/u/883786?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/883786?s=400&v=4 |
| og:image:alt | Adds support for frozendict in dataclassses.astype and dataclasses.asdict. The main effect is that astuple and asdict recurse into a frozendict (just like they recurse into a dict). For example fro... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | d6dc8294eb500fa36bbc57472d61fe87c522f9c3c1d64f70f4926f66a66a7efb |
| 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 | 7ac0ad2f2c7e4b9056617355fd9e33e22b0c8df9 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width