Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CallableType.copy_modified: accept sequence for arg_names #14840

Merged
merged 1 commit into from
Mar 6, 2023

Conversation

ikonst
Copy link
Contributor

@ikonst ikonst commented Mar 6, 2023

In #4070, CallableType.__init__ was changed to accept arg_names: Sequence[str | None] so we could pass e.g. list[str] to it. We're making a similar change to CallableType.copy_modified.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 6, 2023

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@JelleZijlstra JelleZijlstra merged commit 2ab1d82 into python:master Mar 6, 2023
@JukkaL
Copy link
Collaborator

JukkaL commented Mar 6, 2023

This may later have some performance implications, since Sequence operations are currently slower than list operations in compiled code. However, since this is using "bogus" types, there is no impact right now (bogus types are treated as Any by mypyc), and this change fine. I'm leaving this as a note for future readers that might look at this PR.

@ikonst ikonst deleted the 2023-03-05-copy-modified branch March 6, 2023 14:36
@ikonst
Copy link
Contributor Author

ikonst commented Mar 6, 2023

@JukkaL Curious, does this matter given that the sequence is copied by list() in init?

@JukkaL
Copy link
Collaborator

JukkaL commented Mar 6, 2023

A good point, it doesn't make a difference unless we change also __init__ to accept only concrete types.

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.

3 participants