Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-116535: Fix distracting "TypeError" in example code #116538

Merged
merged 2 commits into from
Mar 9, 2024
Merged

gh-116535: Fix distracting "TypeError" in example code #116538

merged 2 commits into from
Mar 9, 2024

Conversation

dec1
Copy link
Contributor

@dec1 dec1 commented Mar 9, 2024

Fix: TypeError: 'int' object is not iterable when you call the sample code:

Note this is not the advertised (and expected) ValueError, which is fixed by using field

@dataclass
class D:
    x: list = []      # This code no longer raises ValueError
    def add(self, element):
        self.x += element # calling this (with an int element) raises TypeError

📚 Documentation preview 📚: https://cpython-previews--116538.org.readthedocs.build/

@dec1 dec1 requested a review from ericvsmith as a code owner March 9, 2024 10:06
Copy link

cpython-cla-bot bot commented Mar 9, 2024

All commit authors signed the Contributor License Agreement.
CLA signed

Copy link
Contributor

@Privat33r-dev Privat33r-dev left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the contribution

@ericvsmith ericvsmith added needs backport to 3.11 only security fixes needs backport to 3.12 bug and security fixes labels Mar 9, 2024
@ericvsmith ericvsmith merged commit db8f423 into python:main Mar 9, 2024
24 checks passed
@miss-islington-app
Copy link

Thanks @dec1 for the PR, and @ericvsmith for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Mar 9, 2024
…h-116538)

(cherry picked from commit db8f423)

Co-authored-by: Declan <5962877+dec1@users.noreply.github.com>
@bedevere-app
Copy link

bedevere-app bot commented Mar 9, 2024

GH-116551 is a backport of this pull request to the 3.12 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.12 bug and security fixes label Mar 9, 2024
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Mar 9, 2024
…h-116538)

(cherry picked from commit db8f423)

Co-authored-by: Declan <5962877+dec1@users.noreply.github.com>
@bedevere-app
Copy link

bedevere-app bot commented Mar 9, 2024

GH-116552 is a backport of this pull request to the 3.11 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.11 only security fixes label Mar 9, 2024
ericvsmith pushed a commit that referenced this pull request Mar 9, 2024
) (gh-116551)

gh-116535: Fix distracting "TypeError" in example code (gh-116538)
(cherry picked from commit db8f423)

Co-authored-by: Declan <5962877+dec1@users.noreply.github.com>
ericvsmith pushed a commit that referenced this pull request Mar 9, 2024
) (gh-116552)

gh-116535: Fix distracting "TypeError" in example code (gh-116538)
(cherry picked from commit db8f423)

Co-authored-by: Declan <5962877+dec1@users.noreply.github.com>
adorilson pushed a commit to adorilson/cpython that referenced this pull request Mar 25, 2024
diegorusso pushed a commit to diegorusso/cpython that referenced this pull request Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants