Skip to content

Conversation

@VanshAgarwal24036
Copy link
Contributor

This PR fixes incorrect ParamSpec default examples in the ParamSpec
docstring shown by help(ParamSpec).

According to the typing specification, ParamSpec defaults must be a list
literal, ellipsis (...), or another ParamSpec. Tuples are not permitted.

The docstring examples previously used tuple defaults. These are updated
to use list defaults to match the typing specification and the existing
documentation.

Closes: gh-143089

@bedevere-app
Copy link

bedevere-app bot commented Dec 25, 2025

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@python-cla-bot
Copy link

python-cla-bot bot commented Dec 25, 2025

All commit authors signed the Contributor License Agreement.

CLA signed

Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

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

There's another case of default=() in test_paramspec, please fix it as well.

picnixz
picnixz previously approved these changes Dec 27, 2025
@picnixz
Copy link
Member

picnixz commented Dec 29, 2025

Actually why didn't you update the test?

@picnixz picnixz dismissed their stale review December 29, 2025 10:10

Tests were not changed

@VanshAgarwal24036
Copy link
Contributor Author

I originally updated the test, but reverted it after CI showed that the runtime default is still expected to be a tuple. So only the docs/examples now use list syntax.

@picnixz
Copy link
Member

picnixz commented Dec 29, 2025

Mmmh, should we actually enforce it at runtime then? maybe as a follow-up PR? cc @JelleZijlstra

@VanshAgarwal24036
Copy link
Contributor Author

That sounds good — I’d be happy to help with a follow-up PR if needed

@JelleZijlstra JelleZijlstra merged commit 67d3d03 into python:main Jan 8, 2026
56 checks passed
@miss-islington-app
Copy link

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

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jan 8, 2026
…f tuple (pythonGH-143179)

(cherry picked from commit 67d3d03)

Co-authored-by: VanshAgarwal24036 <[email protected]>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jan 8, 2026
…f tuple (pythonGH-143179)

(cherry picked from commit 67d3d03)

Co-authored-by: VanshAgarwal24036 <[email protected]>
@bedevere-app
Copy link

bedevere-app bot commented Jan 8, 2026

GH-143538 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.14 bugs and security fixes label Jan 8, 2026
@bedevere-app
Copy link

bedevere-app bot commented Jan 8, 2026

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

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Jan 8, 2026
hugovk pushed a commit that referenced this pull request Jan 8, 2026
hugovk pushed a commit that referenced this pull request Jan 8, 2026
@VanshAgarwal24036 VanshAgarwal24036 deleted the gh-143089-paramspec-doc-fix branch January 8, 2026 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The docstring of ParamSpec should show two examples with a list instead of a tuple

5 participants