Skip to content

Variable annotation triggers exception 'Subscript' object has no attribute 'id' #93

Closed

Description

@gjdm

Variable annotation (e.g. "self.pages: List[SnapFilterView2D] = list()") triggers exception 'Subscript' object has no attribute 'id'

image

gjdm

Activity

  1. changed the title [-]Variable annotation triggers exception 'Suscript' object has no attribute 'id'[/-] [+]Variable annotation triggers exception 'Subscript' object has no attribute 'id'[/+] on Jun 7, 2021
  2. abulka commented on Jun 7, 2021

    @abulka
    Owner

    Thank you for reporting this.

  3. abulka commented on Jun 29, 2021

    @abulka
    Owner

    Tried to reproduce this running under Python 3.9 parsing the following:

    class A:
        def method1(self):
            self.pages: List[SnapFileView2D] = list()

    and got no errors.

    Hmm - perhaps this error only happens with lower version of Python - will need to check. As it stands, it looks promising that no changes to the Pynsource parser are needed, only a Python version bump. That is, assuming the above source code reproduces the problem.

    Update: Tricky variable annotation, Actually turns out that on my mac, it used to fail ONLY in Python 3.9 but passed in 3.7 and 3.8.

  4. added a commit that references this issue on Jun 29, 2021
  5. abulka commented on Jun 30, 2021

    @abulka
    Owner

    Tested parsing this on Mac using official release which uses Python 3.7 internally - worked ok.

    But on Linux the official snap release does exhibit the problem, but running under Python 3.7 from source code does not. Mysterious. Will investigate further.

  6. added a commit that references this issue on Jul 1, 2021
  7. abulka commented on Jul 1, 2021

    @abulka
    Owner

    Changed visit_AnnAssign() in parser to fix this, passes now under all Python versions.

  8. abulka commented on Jul 8, 2021

    @abulka
    Owner

    Latest master branch and 1.78 beta binary release should have fixed this.
    Official 1.78 release only a few days away.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions