Skip to content

Fix empty TypeVarTuple specialization on Python 3.10 - #832

Closed
LittleChenLiya wants to merge 1 commit into
python:mainfrom
LittleChenLiya:fix/empty-typevartuple-specialization
Closed

LittleChenLiya wants to merge 1 commit into
python:mainfrom
LittleChenLiya:fix/empty-typevartuple-specialization

Conversation

@LittleChenLiya

Copy link
Copy Markdown

Fixes #322

Python 3.10 rejects Signal[()] before typing_extensions can validate that the generic's only parameter is a TypeVarTuple. Preserve the empty alias for that case while retaining errors for Generic[()] and generics with required leading parameters.

Regression check: python -m unittest test_typing_extensions.TypeVarTupleTests.test_empty_specialization fails before the fix with TypeError: Parameter list ... cannot be empty and passes afterward on Python 3.10.

Allow a generic whose sole parameter is a TypeVarTuple to accept an empty
argument tuple, matching newer Python versions. Keep rejecting empty
specializations when required parameters remain.

Fixes python#322
@python-cla-bot

python-cla-bot Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

@codecov

codecov Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.08%. Comparing base (6a9be05) to head (3c8d29f).
⚠️ Report is 1 commits behind head on main.

@@           Coverage Diff           @@
##             main     #832   +/-   ##
=======================================
  Coverage   97.07%   97.08%           
=======================================
  Files           3        3           
  Lines        7583     7607   +24     
=======================================
+ Hits         7361     7385   +24     
  Misses        222      222           
Flag Coverage Δ
3.10 91.25% <100.00%> (+0.02%) ⬆️
3.10.4 91.25% <100.00%> (+0.02%) ⬆️
3.11 90.36% <66.66%> (-0.08%) ⬇️
3.11.0 89.60% <66.66%> (-0.08%) ⬇️
3.12 90.29% <66.66%> (-0.08%) ⬇️
3.12.0 90.28% <66.66%> (-0.08%) ⬇️
3.13 85.59% <66.66%> (-0.06%) ⬇️
3.13.0 86.31% <66.66%> (-0.07%) ⬇️
3.14 81.65% <66.66%> (-0.05%) ⬇️
3.14.0 82.40% <66.66%> (-0.06%) ⬇️
3.15 78.79% <66.66%> (-0.04%) ⬇️
3.15.0 78.79% <66.66%> (-0.04%) ⬇️
pypy3.10 91.08% <100.00%> (+0.02%) ⬆️
pypy3.11 90.21% <66.66%> (-0.08%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/test_typing_extensions.py 98.33% <100.00%> (+<0.01%) ⬆️
src/typing_extensions.py 92.36% <100.00%> (+0.04%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@AlexWaygood AlexWaygood left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This looks like a reasonable approach at first glance but, given that Python 3.10 is already end-of-life, I'm not sure it's worth making any changes to this library that only affect 3.10 at this point? The cost/benefit ratio seems too high at this point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TypeError: Parameter list cannot be empty for TypeVarTuple

2 participants