Skip to content

Conversation

@VanshAgarwal24036
Copy link

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.

Copy link
Member

Choose a reason for hiding this comment

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

No news entry is required for this change, please remove it.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for the review! I updated the remaining default=() case in the test and removed the NEWS entry as requested.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks again! I initially changed the default=() in the test, but CI showed that the runtime default value is still expected to be a tuple.
I have now reverted the test change so behavior remains unchanged and only the examples/docs use lists.

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
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

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

4 participants