GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-88071: Update docstrings of dataclass' astuple and asdict by ischurov · Pull Request #101806 · python/cpython

Conversation

@ischurov

@ischurov ischurov commented Feb 10, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Updated docstrings of astuple and asdict to reflect that they deep copy objects in the field values, according to the changes in the docs (see #26154 and #88071).

I believe that this behaviour of astuple and asdict is rather counter-intuitive and it is important to inform the developer about it in the docstring. (I personally spent half an hour trying to fix a bug that appeared because I wasn't aware of it.)

  • Issue: dataclasses.astuple (and .asdict) do deepcopy on all fields #88071

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

wmayner reacted with hooray emoji
All reactions
  • 🎉 1 reaction
@ischurov
Update dataclasses.astuple and dataclasses.asdict docstrings to refle…
c537df5
…ct that they deep copy objects in the field values, according to the changes in the docs, see python#26154
@ischurov
ischurov requested a review from ericvsmith as a code owner February 10, 2023 19:55
@bedevere-bot bedevere-bot added the awaiting review label Feb 10, 2023
@bedevere-bot bedevere-bot mentioned this pull request Feb 10, 2023
dataclasses.astuple (and .asdict) do deepcopy on all fields #88071
Closed
@bedevere-bot

bedevere-bot commented Feb 10, 2023

Copy link
Copy Markdown

Most changes to Python require a NEWS entry.

Please add it using the blurb_it web app or the blurb command-line tool.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ghost

ghost commented Feb 10, 2023 •
edited by ghost
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.
CLA signed

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@arhadthedev arhadthedev added the stdlib Standard Library Python modules in the Lib/ directory label Feb 10, 2023
@hauntsaninja hauntsaninja changed the title gh-88071: Update docstrings gh-88071: Update docstrings of dataclass' astuple and asdict Feb 19, 2023
@hauntsaninja hauntsaninja added the skip news label Feb 19, 2023
carljm
carljm approved these changes Mar 8, 2023
View reviewed changes

@carljm carljm left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable to mention this in the docstring as well as the docs; change LGTM.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-bot bedevere-bot added awaiting merge and removed awaiting review labels Mar 8, 2023
@carljm
carljm merged commit 767d3a8 into python:main Mar 11, 2023
@bedevere-bot bedevere-bot removed the awaiting merge label Mar 11, 2023
iritkatriel pushed a commit to iritkatriel/cpython that referenced this pull request Mar 12, 2023
@ischurov @iritkatriel
pythongh-88071: Update docstrings of dataclass' astuple and asdict (p…
f8d4afb
…ython#101806)

Update dataclasses.astuple and dataclasses.asdict docstrings to reflect that they deep copy objects in the field values.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@carljm carljm carljm approved these changes
@ericvsmith ericvsmith Awaiting requested review from ericvsmith ericvsmith is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

skip news stdlib Standard Library Python modules in the Lib/ directory

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@ischurov @bedevere-bot @carljm @arhadthedev @hauntsaninja
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.