Skip to content

MultiError.exceptions foils linter #1066

Closed

Description

@belm0

Access of exceptions on a MultiError instance elicits "no-member" error from Pylint.

I believe it's because MultiError __new__ is merely mutating the result of BaseException.__new__(MultiError). I'd address it by making a proper __init__() constructor.

Activity

  1. oremanj commented on May 29, 2019

    @oremanj
    Member

    As I pointed out in that PR, using __init__ with MultiError is tricky because of the behavior where MultiError([e]) just returns e.

    Is pylint happier if you write something like this?

    class MultiError:
        exceptions = []
        # ... rest of class ...
    
    del MultiError.exceptions
    
  2. belm0 commented on May 29, 2019

    @belm0
    MemberAuthor

    @oremanj thank you, would have taken me a long time to figure that out.

    I'd rather put an explicit guard in init than a workaround which may only satisfy some linters.

    At the least, trio should have an explicit test for the solitary MultiError case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions