Description
This bug has been found during the setup of the numpy
brains.
Fixing it could improve our inference system for numpy
functions.
The directory described hereafter reflects a similar structure inside the numpy
sources.
Steps to reproduce
- Create a directory named
bug_inf
with the following structure:
$ tree bug_inf
bug_inf
├── core
│ ├── __init__.py
│ └── shape_base.py
├── __init__.py
└── lib
├── __init__.py
└── shape_base.py
bug_inf/core/__init__.py
content is:
$ cat bug_inf/core/__init__.py
from .shape_base import *
bug_inf/core/shape_base.py
content is:
$ cat bug_inf/core/shape_base.py
def vstack():
return 42
bug_inf/__init__.py
content is:
$ cat bug_inf/__init__.py
from .core import *
from .lib import *
bug_inf/lib/__init__.py
content is:
$ cat bug_inf/lib/__init__.py
from .shape_base import *
bug_inf/lib/shape_base.py
content is:
$ cat bug_inf/lib/shape_base.py
from bug_inf.core import vstack
- Create a file
bug_inf.py
which content is:
from astroid import extract_node
SRC = """
from bug_inf import vstack
vstack()
"""
NODE = extract_node(SRC)
print(NODE.inferred())
- Run
python3 bug_inf.py
Current behavior
$ python3 bug_inf.py
[<Const.int l.2 at 0x7f08471338d0>, Uninferable]
Expected behavior
$ python3 bug_inf.py
[<Const.int l.2 at 0x7f08471338d0>]
Astroid version
python3 -c "from astroid import __pkginfo__; print(__pkginfo__.version)"
2.3.0
Metadata
Metadata
Assignees
Labels
No labels