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

Revert "Fix callable instance variable support (#10548)" #11571

Merged
merged 1 commit into from
Nov 17, 2021

Commits on Nov 17, 2021

  1. Revert "Fix callable instance variable support (#10548)"

    This reverts commit 6ab0efc.
    
    Reverting the change since it causes a significant backward
    compatibility break. Code like this previously worked as expected:
    
    ```
    class C:
        def f(self) -> None: pass
    
        g = f
    
    C().g()
    ```
    
    However, #10548 broke this in a subtle way (no error on definition),
    and instead required the introduction of a ClassVar annotation for
    `g`, which is non-intuitive and error-prone. For example, some
    typeshed stubs use method aliases such as the above (e.g. stubs for
    `logging`), and the change broke those stubs. It's also arguably
    inconsistent, since normally ClassVar annotations are optional.
    
    Any fix to the original issue should avoid breaking method aliases
    such as the above. Hopefully the fix can be adjusted suitably.
    
    The PR may have broken incremental mode somehow as well -- cached
    and uncached runs sometimes produce different results. The root
    cause is still unclear, however.
    JukkaL committed Nov 17, 2021
    Configuration menu
    Copy the full SHA
    de4333f View commit details
    Browse the repository at this point in the history