Skip to content

New semantic analyzer: allow redefinition of star-imported functions if type is the same #6950

@ilevkivskyi

Description

@ilevkivskyi

Consider this test case:

[case testReExportOtherSameType]
from low_level import *

def func(arg: str) -> int:
    ...

[file low_level.py]
def func(arg: str) -> int:
    ...

It is currently allowed by old analyzer (likely by accident), but prohibited by the new one. Old analyzer still prohibits this if the function is imported by name instead of star import. Although behavior of the new analyzer is more consistent, it may be sometimes useful to allow the redefinition (for example when star import re-exports hundred functions).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions