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

Change types in "builtins" and "types" modules to have __new__ instead of __init__, where necessary #10761

Merged
merged 3 commits into from
Sep 25, 2023

Conversation

plokmijnuhby
Copy link
Contributor

This means that calls to eg range.__new__(range, 0) will be checked correctly. The most common case for this is if a subclass of range makes its own __new__ method, and calls super().__new__ (although some of the classes affected by this PR cannot be subclassed).

I have deliberately ignored the reversed class, because it is the subject of its own ongoing PR, #10655.

@github-actions
Copy link
Contributor

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

Copy link
Collaborator

@srittau srittau left a comment

Choose a reason for hiding this comment

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

Thanks!

@srittau srittau merged commit cec86eb into python:main Sep 25, 2023
facebook-github-bot pushed a commit to facebook/pyre-check that referenced this pull request Nov 28, 2023
Summary:
- sqlite2.dbapi2.Connection.execute: https://github.com/python/typeshed/blob/main/stdlib/sqlite3/dbapi2.pyi#L355C1-L356C1 sqlite execute takes a `__sql`instead of `sql`
- getattr https://github.com/python/typeshed/blob/main/stdlib/builtins.pyi#L1428 `name` param is now `__name`
- filter python/typeshed#10761 modified builtins type to use `__new__` instead of `__init__` (https://github.com/python/typeshed/blob/main/stdlib/builtins.pyi#L1416)
- enumerate: similar to point above https://github.com/python/typeshed/blob/main/stdlib/builtins.pyi#L1208C9-L1208C16

Reviewed By: arthaud

Differential Revision: D51464336

fbshipit-source-id: eb4aa6e04707c1c1d4ab3b5b02f27fd4e044189f
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.

2 participants