Skip to content

Source code that has @final decorator does not require @final in stub #14921

Closed

Description

@sobolevn

Today I got hit by this. This was the source code:

from typing import final

@final
class A: ...

This was the stub:

class A: ...

But, stubtest allowed this.
I think that we should also check for __final__ attribute.

For example, some stdlib code already has @final decorators applied, like: https://github.com/python/cpython/blob/e1e9bab0061e8d4bd7b94ed455f3bb7bf8633ae7/Lib/asyncio/timeouts.py#L26

I will send a PR with the fix.

Activity

  1. self-assigned this
    on Mar 18, 2023
  2. added a commit that references this issue on Mar 18, 2023
    5b3fcab
  3. added a commit that references this issue on Mar 19, 2023
    e07ccde
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions