Skip to content

typing.TypedDict: unnecessary hasattr check #109543

Closed

Description

@JelleZijlstra

These lines:

https://github.com/python/cpython/blob/412f5e85d6b9f2e90c57c54539d06c7a025a472a/Lib/typing.py#L2889-2890

        if not hasattr(tp_dict, '__total__'):
            tp_dict.__total__ = total

go out of their way to account for the case there a TypedDict already has a __total__ attribute. But I don't think there is any way for the TypedDict to have that attribute at this point. For clarity, we should remove the check.

Linked PRs

Activity

  1. added 2 commits that reference this issue on Sep 18, 2023
  2. hauntsaninja commented on Sep 20, 2023

    @hauntsaninja
    Contributor

    Looks like we can close this out!

  3. added a commit that references this issue on Sep 28, 2023
  4. added a commit that references this issue on Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions