Skip to content

Conversation

@adamtheturtle
Copy link
Contributor

@adamtheturtleadamtheturtle commented Dec 23, 2024

Running

{}.setdefault("a", default=1)

gives:

TypeError: dict.setdefault() takes no keyword arguments 

📚 Documentation preview 📚: https://cpython-previews--128208.org.readthedocs.build/en/128208/library/stdtypes.html#dict.setdefault

Running ```python{}.setdefault("a", default=1) ``` gives: ``` TypeError: dict.setdefault() takes no keyword arguments ```
@bedevere-appbedevere-appbot added docs Documentation in the Doc dir skip news awaiting review labels Dec 23, 2024
@adamtheturtle
Copy link
ContributorAuthor

Related: #128207

@ZeroIntensityZeroIntensity added needs backport to 3.12 only security fixes needs backport to 3.13 bugs and security fixes labels Mar 25, 2025
Copy link
Member

@ZeroIntensityZeroIntensity left a comment

Choose a reason for hiding this comment

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

Sorry for the delay on the review. Could you document this for get as well?

@adamtheturtle
Copy link
ContributorAuthor

Could you document this for get as well?

@ZeroIntensity I have now done that

Copy link
Member

@ZeroIntensityZeroIntensity left a comment

Choose a reason for hiding this comment

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

Thanks, LGTM.

@picnixzpicnixz changed the title Document that dict.setdefault takes no keyword argumentsgh-131885: Document that dict.setdefault takes no keyword argumentsMar 30, 2025
Copy link
Member

@picnixzpicnixz left a comment

Choose a reason for hiding this comment

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

We could argue that this would violate the Mapping contract and that we have a "bug". Yes it violates the contract, however, the EB has decided that this should be the guidelines (see also #129669 (comment)), so this specific change should not be blocked.

@picnixzpicnixz enabled auto-merge (squash) March 30, 2025 09:18
@picnixzpicnixz merged commit edfbd8c into python:mainMar 30, 2025
26 checks passed
@github-project-automationgithub-project-automationbot moved this from Todo to Done in Docs PRsMar 30, 2025
@miss-islington-app
Copy link

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

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Mar 30, 2025
…no keyword arguments (pythonGH-128208) (cherry picked from commit edfbd8c) Co-authored-by: Adam Dangoor <adamdangoor@gmail.com>
@bedevere-app
Copy link

GH-131893 is a backport of this pull request to the 3.13 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.13 bugs and security fixes label Mar 30, 2025
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Mar 30, 2025
…no keyword arguments (pythonGH-128208) (cherry picked from commit edfbd8c) Co-authored-by: Adam Dangoor <adamdangoor@gmail.com>
@bedevere-app
Copy link

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

@bedevere-appbedevere-appbot removed the needs backport to 3.12 only security fixes label Mar 30, 2025
@picnixz
Copy link
Member

Thank you for the fix!

picnixz pushed a commit that referenced this pull request Mar 30, 2025
… no keyword arguments (GH-128208) (#131893) gh-131885: Document that `dict.setdefault` and `dict.get` take no keyword arguments (GH-128208) (cherry picked from commit edfbd8c) Co-authored-by: Adam Dangoor <adamdangoor@gmail.com>
picnixz pushed a commit that referenced this pull request Mar 30, 2025
… no keyword arguments (GH-128208) (#131894) gh-131885: Document that `dict.setdefault` and `dict.get` take no keyword arguments (GH-128208) (cherry picked from commit edfbd8c) Co-authored-by: Adam Dangoor <adamdangoor@gmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docsDocumentation in the Doc dirskip news

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants

@adamtheturtle@picnixz@ZeroIntensity