wala/ML

Missing cases for importing scripts from package initialization code

Offen

#210 geöffnet am 22.07.2024

 (0 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)Java (17 Forks)auto 404
PYTHONPATHenhancementhelp wanted

Repository-Metriken

Stars
 (27 Sterne)
PR-Merge-Metriken
 (PR-Metriken ausstehend)

Beschreibung

We're missing some cases from #202 where we import scripts containing package initialization code that involve the syntax import A.B.C. It looks like we covered from A.B import C. Consider the following example:

# src/__init__.py
from .module import *

# src/module.py
import tensorflow as tf

def f(a):
    assert isinstance(a, tf.Tensor)

# client.py
from tensorflow import ones
import src

src.f(ones([1, 2]))

We cannot find a CG node for src.module.f. If we change the wildcard in src/__init__.py to explicitly reference f, it still doesn't work.

Regression

I don't think this is a bug. I think we just only handled the wildcard import case in the client.

Contributor Guide