Skip to content

New analyser: Crash in attrs plugin on bad or deferred name #7098

Closed
@ilevkivskyi

Description

@ilevkivskyi

Both of these crash with the new analyser:

[case testTypeInAttrBad]
import attr

@attr.s
class C:
    total = attr.ib(type=Bad)

[builtins fixtures/bool.pyi]

and

[case testTypeInAttrBad2]
import attr

@attr.s
class C:
    total = attr.ib(default=func())

def func(): ...
[builtins fixtures/bool.pyi]

Both crash with an assertion error because plugin doesn't expect a placeholder in class symbol table. I didn't check dataclasses, but likely there is a similar issue.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions