Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-138859: Account forParamSpec defaults that are not lists …#138868

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
JelleZijlstra merged 6 commits intopython:mainfrombzoracler:issue-138859
Oct 16, 2025

Conversation

@bzoracler
Copy link
Contributor

@bzoraclerbzoracler commentedSep 13, 2025
edited by bedevere-appbot
Loading

@python-cla-bot
Copy link

python-cla-botbot commentedSep 13, 2025
edited
Loading

All commit authors signed the Contributor License Agreement.

CLA signed

@bedevere-app
Copy link

Most changes to Pythonrequire a NEWS entry. Add one using theblurb_it web app or theblurb command-line tool.

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

Lib/typing.py Outdated
elifisinstance(args[i],list):
args= (*args[:i],tuple(args[i]),*args[i+1:])
else:
args= (*args[:i],args[i],*args[i+1:])
Copy link
Member

Choose a reason for hiding this comment

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

this can be simplified toargs = tuple(args)

bzoracler reacted with thumbs up emoji
@@ -0,0 +1 @@
Fix failure during parameterization of generics when a non-type-list `ParamSpec` default is followed by another type variable default, and the `ParamSpec` is not provided as a type argument.
Copy link
Member

Choose a reason for hiding this comment

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

We userst, notmd in NEWS, so please use double backticks.

bzoracler reacted with thumbs up emoji
Lib/typing.py Outdated
# Convert lists to tuples to help other libraries cache the results.
elifisinstance(args[i],list):
args= (*args[:i],tuple(args[i]),*args[i+1:])
else:

Choose a reason for hiding this comment

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

Should we create a tuple directly on line 1103 above instead?

bzoracler reacted with thumbs up emoji
@@ -0,0 +1 @@
Fix failure during parameterization of generics when a non-type-list ``ParamSpec`` default is followed by another type variable default, and the ``ParamSpec`` is not provided as a type argument.
Copy link
Member

Choose a reason for hiding this comment

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

Sorry, I don't understand what "non-type-list" is. I propose this wording:

Suggested change
Fix failure during parameterization of generics when a non-type-list ``ParamSpec`` default is followed by another type variable default, and the ``ParamSpec`` is not provided as a type argument.
Fixes a:exc:`TypeError` when substituting a:class:`ParamSpec` with a default
that is followed by another:class:`TypeVar` with a default.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Thanks, the original description was unclear. Unless there are other objections, I'll reduce it to

Fix generic type parameterization raising a :exc:TypeError when omitting a :class:ParamSpec that has a non-type-list default.


"Non-type-list default" refers to the bug occurring if the ParamSpec default isn't a list of types, such as... orP (another ParamSpec in scope). The bug would not be encountered if the default was a list of types (like[int, str]).

I think the closest wording for this construct in the documentation is actually "list of types" (see e.g.ParamSpec Defaults), but I don't think "list of types" is necessarily better than "type list".

Choose a reason for hiding this comment

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

Let's say something like "default that is not a list of types". "type list" is definitely less clear to me than "list of types".

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Rewording suggestions done in9669479

@sergey-miryanov
Copy link
Contributor

@bzoracler Something left to do here? Is it ready for review?

@bzoracler
Copy link
ContributorAuthor

@sergey-miryanov I think I've addressed everything.

@JelleZijlstra Are there any other concerns?

@JelleZijlstraJelleZijlstra added needs backport to 3.13bugs and security fixes needs backport to 3.14bugs and security fixes labelsOct 16, 2025
@JelleZijlstraJelleZijlstra merged commit379fd02 intopython:mainOct 16, 2025
53 checks passed
@miss-islington-app
Copy link

Thanks@bzoracler 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 requestOct 16, 2025
pythonGH-138868)(cherry picked from commit379fd02)Co-authored-by: bzoracler <50305397+bzoracler@users.noreply.github.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestOct 16, 2025
pythonGH-138868)(cherry picked from commit379fd02)Co-authored-by: bzoracler <50305397+bzoracler@users.noreply.github.com>
@bedevere-app
Copy link

GH-140207 is a backport of this pull request to the3.14 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.14bugs and security fixes labelOct 16, 2025
@bedevere-app
Copy link

GH-140208 is a backport of this pull request to the3.13 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.13bugs and security fixes labelOct 16, 2025
@JelleZijlstra
Copy link
Member

@bzoracler it looks like you'll have to re-sign the CLA under a different email address for the backports (#140208 and#140207) to go through. As I understand it this can happen if you have different email addresses associated with your GitHub account and your commits.

@bzoraclerbzoracler deleted the issue-138859 branchOctober 16, 2025 18:40
@bzoracler
Copy link
ContributorAuthor

@JelleZijlstra oh, it looks like rebasing straight from the GitHub UI made the commits under a different email address (@users.noreply.github.com) because of GitHub email privacy settings. I've signed the CLA with that one as well.

Thanks all!

JelleZijlstra pushed a commit that referenced this pull requestOct 16, 2025
… … (GH-138868) (#140208)gh-138859: Account for `ParamSpec` defaults that are not lists … (GH-138868)(cherry picked from commit379fd02)Co-authored-by: bzoracler <50305397+bzoracler@users.noreply.github.com>
JelleZijlstra pushed a commit that referenced this pull requestOct 16, 2025
… … (GH-138868) (#140207)gh-138859: Account for `ParamSpec` defaults that are not lists … (GH-138868)(cherry picked from commit379fd02)Co-authored-by: bzoracler <50305397+bzoracler@users.noreply.github.com>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@sobolevnsobolevnsobolevn left review comments

@JelleZijlstraJelleZijlstraJelleZijlstra approved these changes

@AlexWaygoodAlexWaygoodAwaiting requested review from AlexWaygoodAlexWaygood is a code owner

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@bzoracler@sergey-miryanov@JelleZijlstra@sobolevn

[8]ページ先頭

©2009-2025 Movatter.jp