[issue44793] Arguments ignored in substitution in typing.Callable

2021-08-02 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44793] Arguments ignored in substitution in typing.Callable

2021-08-02 Thread miss-islington


miss-islington  added the comment:


New changeset c8db292012dd84aab81eb3ed9146709696a3d290 by Miss Islington (bot) 
in branch '3.10':
bpo-44793: Fix checking the number of arguments when subscribe a generic type 
with ParamSpec parameter. (GH-27515)
https://github.com/python/cpython/commit/c8db292012dd84aab81eb3ed9146709696a3d290


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44793] Arguments ignored in substitution in typing.Callable

2021-08-02 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 3.0 -> 4.0
pull_requests: +26047
pull_request: https://github.com/python/cpython/pull/27537

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44793] Arguments ignored in substitution in typing.Callable

2021-08-02 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset f92b9133ef67e77605cbd315b6b6c81036ce110e by Serhiy Storchaka in 
branch 'main':
bpo-44793: Fix checking the number of arguments when subscribe a generic type 
with ParamSpec parameter. (GH-27515)
https://github.com/python/cpython/commit/f92b9133ef67e77605cbd315b6b6c81036ce110e


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44793] Arguments ignored in substitution in typing.Callable

2021-07-31 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

There is also similar bug in Generic:

>>> from typing import *
>>> T = TypeVar("T")
>>> P = ParamSpec("P")
>>> class X(Generic[T, P]):
... f: Callable[P, int]
... x: T
... 
>>> P_2 = ParamSpec("P_2")
>>> X[int, P_2, str]
__main__.X[int, ~P_2]

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44793] Arguments ignored in substitution in typing.Callable

2021-07-31 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
keywords: +patch
pull_requests: +26030
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/27515

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44793] Arguments ignored in substitution in typing.Callable

2021-07-31 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

If Callable is nested, it works as expected:

>>> typing.List[C][int, str, float]
Traceback (most recent call last):
  File "", line 1, in 
  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 231, in _check_generic
raise TypeError(f"Too {'many' if alen > elen else 'few'} parameters for 
{cls};"

^^^
TypeError: Too many parameters for typing.List[typing.Callable[~P, ~T]]; actual 
3, expected 2

collections.abc.Callable raises an error too.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44793] Arguments ignored in substitution in typing.Callable

2021-07-31 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

>>> import typing
>>> T = typing.TypeVar('T')
>>> P = typing.ParamSpec('P')
>>> C = typing.Callable[P, T]
>>> C[int, str, float]
typing.Callable[[int], str]

int substitutes P as [int], str substitutes T, and the third argument float is 
ignored.

--
components: Library (Lib)
messages: 398636
nosy: gvanrossum, kj, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Arguments ignored in substitution in typing.Callable
type: behavior
versions: Python 3.10, Python 3.11

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com