GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Substitution does not work after ParamSpec substitution of the user generic with a list of TypeVars · Issue #88965 · python/cpython

Substitution does not work after ParamSpec substitution of the user generic with a list of TypeVars #88965

New issue
Copy link
New issue
Copy link
Closed
Closed
Substitution does not work after ParamSpec substitution of the user generic with a list of TypeVars#88965
Copy link
Assignees
serhiy-storchaka
Labels
3.10 (EOL)end of lifeend of life3.11only security fixesonly security fixes3.12only security fixesonly security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-typingtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@serhiy-storchaka
serhiy-storchaka
opened on Aug 1, 2021
Issue body actions
BPO 44802
Nosy @gvanrossum, @serhiy-storchaka, @Fidget-Spinner

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = None
created_at = <Date 2021-08-01.11:37:51.360>
labels = ['type-bug', 'library', '3.10', '3.11']
title = 'Substitution does not work after ParamSpec substitution of the user generic with a list of TypeVars'
updated_at = <Date 2021-08-01.11:37:51.360>
user = 'https://github.com/serhiy-storchaka'

bugs.python.org fields:

activity = <Date 2021-08-01.11:37:51.360>
actor = 'serhiy.storchaka'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['Library (Lib)']
creation = <Date 2021-08-01.11:37:51.360>
creator = 'serhiy.storchaka'
dependencies = []
files = []
hgrepos = []
issue_num = 44802
keywords = []
message_count = 1.0
messages = ['398694']
nosy_count = 3.0
nosy_names = ['gvanrossum', 'serhiy.storchaka', 'kj']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue44802'
versions = ['Python 3.10', 'Python 3.11']

Linked PRs

  • gh-88965: Fix type substitution of a list of types after initial ParamSpec substitution #102808
  • [3.11] gh-88965: typing: fix type substitution of a list of types after initial ParamSpec substitution (GH-102808) #102957

Activity

  1. serhiy-storchaka commented on Aug 1, 2021

    @serhiy-storchaka
    serhiy-storchaka
    on Aug 1, 2021
    MemberAuthor
    More actions

    If the user generic with ParamSpec parameter substituted with a parametrised list containing TypeVar, that TypeVar cannot be substituted.

    >>> from typing import *
    >>> T = TypeVar("T")
    >>> P = ParamSpec("P")
    >>> class X(Generic[P]):
    ...     f: Callable[P, int]
    ... 
    >>> Y = X[[int, T]]
    >>> Y
    __main__.X[(<class 'int'>, ~T)]
    >>> Y[str]
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/home/serhiy/py/cpython/Lib/typing.py", line 309, in inner
        return func(*args, **kwds)
               ^^^^^^^^^^^^^^^^^^^
      File "/home/serhiy/py/cpython/Lib/typing.py", line 1028, in __getitem__
        _check_generic(self, params, len(self.__parameters__))
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/home/serhiy/py/cpython/Lib/typing.py", line 228, in _check_generic
        raise TypeError(f"{cls} is not a generic class")
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    TypeError: __main__.X[(<class 'int'>, ~T)] is not a generic class

    Expected result equal to X[[int, str]].

    Reacted by LeeeeT
  2. serhiy-storchaka
    added
    3.10 (EOL)end of lifeend of life
    3.11only security fixesonly security fixes
    stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Aug 1, 2021
  3. ezio-melotti
    transferred this issue fromon Apr 10, 2022
  4. AlexWaygood
    added
    topic-typing
    on Apr 13, 2022
  5. LeeeeT commented on Nov 11, 2022

    @LeeeeT
    LeeeeT
    on Nov 11, 2022
    More actions

    Hi there! I'm experiencing the same issue. Will this be fixed? @serhiy-storchaka

  6. serhiy-storchaka
    self-assigned this
    on Nov 11, 2022
  7. AlexWaygood
    added
    3.12only security fixesonly security fixes
    on Mar 15, 2023
  8. sobolevn
    added a commit that references this issue on Mar 18, 2023

    pythongh-88965: Fix type substitution of a list of types after initia…

    55662cc
  9. AlexWaygood
    added a commit that references this issue on Mar 23, 2023

    gh-88965: typing: fix type substitution of a list of types after init…

    adb0621
  10. miss-islington
    added a commit that references this issue on Mar 23, 2023

    pythongh-88965: typing: fix type substitution of a list of types afte…

    3d006ac
  11. AlexWaygood commented on Mar 23, 2023

    @AlexWaygood
    AlexWaygood
    on Mar 23, 2023
    Member
    More actions

    Fixed on main and 3.11, but we've decided not to backport to 3.10.

  12. AlexWaygood
    closed this as completedon Mar 23, 2023
  13. miss-islington
    added a commit that references this issue on Mar 23, 2023

    gh-88965: typing: fix type substitution of a list of types after init…

    1645a40
  14. LeeeeT commented on Mar 23, 2023

    @LeeeeT
    LeeeeT
    on Mar 23, 2023
    More actions

    Thanks! You guys are awesome! ❤️

    Reacted by Alex Waygood
  15. AlexWaygood commented on Mar 23, 2023

    @AlexWaygood
    AlexWaygood
    on Mar 23, 2023
    Member
    More actions

    Thanks! You guys are awesome! ❤️

    @sobolevn gets all the credit on this one :)

    Reacted by LeeeeT
  16. Fidget-Spinner
    added a commit that references this issue on Mar 27, 2023

    pythongh-88965: typing: fix type substitution of a list of types afte…

    67a48e5
  17. warsaw
    added a commit that references this issue on Apr 11, 2023

    pythongh-88965: typing: fix type substitution of a list of types afte…

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

Metadata

Metadata

Assignees

  • @serhiy-storchaka
    serhiy-storchaka

Labels

3.10 (EOL)end of lifeend of life3.11only security fixesonly security fixes3.12only security fixesonly security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-typingtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.