Skip to content

Accessing a field from the class is not yet supported #12

Closed

Description

@smarie

Currently PyCharm has an issue with type hints when the __get__ descriptor returns self for class access. See https://youtrack.jetbrains.com/issue/PY-38151

So this behaviour is currently disabled and replaced with an exception (raise ClassFieldAccessError). We should put it back when it is fixed on pycharm.

For example see https://github.com/smarie/python-pyfields/blob/master/pyfields/core.py#L800

Activity

  1. added
    bug
    on Sep 25, 2019
  2. smarie commented on Nov 16, 2019

    @smarie
    OwnerAuthor

    There is now also a helper method getfield(cls, name) to do this, as a workaround while we wait for the pycharm fix.

  3. smarie commented on Mar 8, 2020

    @smarie
    OwnerAuthor

    Note that this issue causes inspect.getmembers(cls) to fail on classes holding at least one field

  4. smarie commented on Apr 14, 2020

    @smarie
    OwnerAuthor

    Great news: I managed to submit a fix to PyCharm : https://youtrack.jetbrains.com/issue/PY-38151
    It should be released in 2020.2.

    When this is done, I'll be able to fix the issue here, there is no reason to artificially maintain this exception.

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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions