Skip to content

Add lint error for _any_ except block that might raise #262

Closed

Description

@Zac-HD

c.f. python-trio/trio#455 (comment) - this would be similar to ASYNC102 but I think ideally a separate rule so that people who wish to disable this (if lost exceptions aren't a big deal for them) don't reintroduce lost cancellations.

We should probably also do something similar for __aexit__ methods, although this gets increasingly awkward for @asynccontextmanager functions and so that should probably be a further separate rule.

Activity

  1. jakkdl commented on Jul 17, 2024

    @jakkdl
    Member

    __aexit__ seems straightforward, we just treat the content of the whole method as if it's a finally:, and can probably use ASYNC102 for it.
    For @asynccontextmanager, 102/120 should already cover if the yield is inside a try: - so I think that should maybe have an entirely separate rule for yield-in-async-cm-not-in-try?

  2. changed the title [-]New rule: warn about _any_ `except` block that might raise[/-] [+]Add lint error for _any_ `except` block that might raise[/+] on Aug 3, 2024
  3. jakkdl commented on Oct 28, 2024

    @jakkdl
    Member

    with #307 closed this is now fully addressed once #306 is merged

  4. linked a pull request that will close this issue102 now also checks __aexit__ #306on Oct 28, 2024
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