Skip to content

Should __module__ be defined as class attribute? #12128

Open

Description

@dvarrazzo

Ref.

__module__: str

This results in mypyc raising an error upon code accessing obj.__class__.__module__, which I believe is the canonical way to get the attribute. See mypyc/mypyc#1055

Note that Cython doesn't define obj.__module__, therefore it makes difficult to write portable code.

Activity

  1. AlexWaygood commented on Jun 11, 2024

    @AlexWaygood
    Member

    See #8787 and #8789 for previous discussion

  2. srittau commented on Jun 11, 2024

    @srittau
    Collaborator

    Maybe we could revisit #8789? Seems like a mypy problem that may or may not be fixed in the meantime, but should probably be fixed in any case.

  3. AlexWaygood commented on Jun 11, 2024

    @AlexWaygood
    Member

    Yeah I'm definitely open to revisiting either #8787 or #8789! The current stubs are incorrect, for sure.

  4. SamB commented on Feb 7, 2025

    @SamB

    Maybe object should just get that attribute, though I guess that only helps in the future …

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions