Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
eugene57 opened this issue Feb 25, 2022 · 1 comment · Fixed by #1540
Closed

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

eugene57 opened this issue Feb 25, 2022 · 1 comment · Fixed by #1540
Labels
Milestone

Comments

@eugene57
Copy link

eugene57 commented Feb 25, 2022

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

@timmartin
Copy link
Contributor

I think the same issue applies to list, set and bytearray. I think we can deal with all these at the same time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants