Skip to content

dict.copy() result is not inferred as dict #1403

@eugene57

Description

@eugene57

Steps to reproduce

Run this code:

import astroid

code = """
x = dict()
y = x.copy()
"""

ast = astroid.parse(code)

for name in ('x', 'y'):
  node = ast.locals[name][0]
  print(name, node.inferred())

Current behavior

x [<Dict.dict l.2 at 0x7fffe852e110>]
y [Uninferable]

Expected behavior

I expect y to be inferred as dict too.

python -c "from astroid import __pkginfo__; print(__pkginfo__.version)" output

2.4.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions