This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: `Concatenate` is not covered to be a return type in `test_typing`
Type: behavior Stage: resolved
Components: Tests Versions: Python 3.11
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: gvanrossum, kj, sobolevn
Priority: normal Keywords: patch

Created on 2022-01-16 08:27 by sobolevn, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 30618 closed sobolevn, 2022-01-16 08:31
Messages (5)
msg410681 - (view) Author: Nikita Sobolev (sobolevn) * (Python triager) Date: 2022-01-16 08:27
Right now all `Concatenate` tests do not cover `Callable[..., Concatenate]` case.

Link: https://github.com/python/cpython/blob/09087b8519316608b85131ee7455b664c00c38d2/Lib/test/test_typing.py#L4862-L4877

I think, that this should be improved. It is an important case.
PR is on its way.
msg410685 - (view) Author: Ken Jin (kj) * (Python committer) Date: 2022-01-16 09:35
Sorry I'm confused: Callable[..., Concatenate] is invalid usage. So I don't think we need to test it.

https://docs.python.org/3/library/typing.html#typing.Concatenate. "Concatenate is currently only valid when used as the first argument to a Callable."
msg410686 - (view) Author: Nikita Sobolev (sobolevn) * (Python triager) Date: 2022-01-16 09:37
> Sorry I'm confused: Callable[..., Concatenate] is invalid usage. So I don't think we need to test it.

Yes, my bad :)

In this case, do we need to make this a `TypeError`? Right now you can use `Concatenate` as the return type.
msg410689 - (view) Author: Ken Jin (kj) * (Python committer) Date: 2022-01-16 09:54
> In this case, do we need to make this a `TypeError`? Right now you can use `Concatenate` as the return type.

Last I recall, we stopped checking anything in the param args of Callable since 3.10 because it has too many problems with inter-version typing and typing_extensions usage. E.g. in Python 3.8

Callable[typing_extensions.Concatenate[...], ...]

was extremely difficult to implement in typing_extensions since Callable checks were too strict back then (they only allowed list of args). So to avoid such problems in the future, we ceased all param args checking.

For the return arg, I'm not too keen on adding more checks for the same reason of allowing future additions. Also the static type checker should warn the user and mypy correctly does that.
msg410691 - (view) Author: Nikita Sobolev (sobolevn) * (Python triager) Date: 2022-01-16 10:01
Thank you for the explanation, Ken Jin.

Going to close this issue as invalid.
History
Date User Action Args
2022-04-11 14:59:54adminsetgithub: 90553
2022-01-16 10:01:17sobolevnsetstatus: open -> closed
resolution: not a bug
messages: + msg410691

stage: patch review -> resolved
2022-01-16 09:54:02kjsetmessages: + msg410689
2022-01-16 09:37:23sobolevnsetmessages: + msg410686
2022-01-16 09:35:35kjsetmessages: + msg410685
2022-01-16 08:31:07sobolevnsetkeywords: + patch
stage: patch review
pull_requests: + pull_request28822
2022-01-16 08:30:47kumaradityasetnosy: + gvanrossum, kj
2022-01-16 08:27:37sobolevncreate