Skip to content
This repository was archived by the owner on Mar 8, 2020. It is now read-only.
This repository was archived by the owner on Mar 8, 2020. It is now read-only.

Different Node classes in the same package #122

Closed

Description

@vmarkovtsev
import importlib
import bblfsh

m = importlib.import_module('bblfsh.gopkg.in.bblfsh.sdk.v1.protocol.generated_pb2_grpc')
print(id(m.generated__pb2.gopkg_dot_in_dot_bblfsh_dot_sdk_dot_v1_dot_uast_dot_generated__pb2.Node))
print(id(bblfsh.Node))
m = importlib.import_module('bblfsh.gopkg.in.bblfsh.sdk.v1.uast.generated_pb2')
print(id(m.Node))

The first printed number is different from the rest. That's because bblfsh/gopkg/in/bblfsh/sdk/v1/protocol/generated_pb2_grpc.py does

import generated_pb2 as generated__pb2

As soon as the module is imported from the different PYTHONPATH, the classes get screwed and although they are really the same, they are different. Hence isinstance() returns False on 3.7, etc.

Suggested fix: remove all the tricks with PYTHONPATH and make all the imports absolute everywhere and starting with bblfsh..

Activity

  1. vmarkovtsev commented on Sep 4, 2018

    @vmarkovtsev
    ContributorAuthor

    I am on it.

  2. added a commit that references this issue on Sep 5, 2018
  3. vmarkovtsev commented on Dec 12, 2018

    @vmarkovtsev
    ContributorAuthor

    Fixed long time ago

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions