pylint-dev / pylint-dev/astroid

Check for Starred when checking the number of arguments passed to functions

Open
#186 0 comments 0 reactions 0 assignees View on GitHub
Bug 🪳
Dominant language
Python
Stars
582
Forks
357
Avg merge
1d 1h
Merged PRs (30d)
23

Description

Originally reported by: **Claudiu Popa (BitBucket: [PCManticore](http://bitbucket.org/PCManticore), GitHub: @PCManticore)**

---

There are a lot of places, especially in astroid.brain.builtin_transform, where we're checking the number of arguments the given builtin received, giving up the custom inference if the arguments mismatches.

Recently, since the changes related to Python 3.5 support, in Call.args we can have Starred nodes, which needs to be unpacked before verifying the number of arguments.

```
#!python

slice(*(1, 2, 3))
getattr(*("a", attr, None))
...
```

---
- Bitbucket: https://bitbucket.org/logilab/astroid/issue/186

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by inspecting astroid.brain.builtin_transform and searching for the other places that compare builtin argument counts. Trace how Starred nodes appear in Call.args using the slice(*(1, 2, 3)) and getattr(*('a', attr, None)) examples. Done means custom inference no longer gives up when starred arguments can be unpacked to the expected count.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.