pylint-dev / pylint-dev/astroid

astroid.node_classes.Keyword lineno is None

Open
#609 1 comment 0 reactions 0 assignees View on GitHub
Documentation :green_book: T: Line numbering
Dominant language
Python
Stars
582
Forks
357
Avg merge
1d 1h
Merged PRs (30d)
23

Description

### Steps to reproduce
`astroid.node_classes.Keyword` does not seem to have a populated `lineno`. Its `repr` does show a line number though. Is this a bug?

```python
#!/usr/bin/env python3
import astroid

ast = astroid.parse('foo(keyword="bar")')
expr = ast.body[0]
call = next(expr.get_children())
name, keyword = tuple(call.get_children())
print(repr(keyword), 'lineno is', keyword.lineno)

```

### Current behavior
```python
lineno is None
```

### Expected behavior
```python
lineno is 1
```

### ``python -c "from astroid import __pkginfo__; print(__pkginfo__.version)"`` output
2.0.4 (on Python 3.7.0)

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the issue with the provided Python snippet and inspect astroid.node_classes.Keyword, especially how its line number is populated. Confirm that the keyword node reports lineno 1 while preserving the existing repr output, then add or update the relevant regression coverage if the repository provides a nearby test location.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devtools
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.