Skip to content

Commit 212862c

Browse files
committed
Fix unpacking starred assignment (#71)
1 parent 026a500 commit 212862c

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

docs/src/release_notes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Unreleased
1313
- Declare CSS class as public API (:issue:`3`)
1414
- Add ability to link to subclass documentation (:issue:`68`)
1515
- Append a newline to error messages with source code (:issue:`70`)
16+
- Fix unpacking starred assignment (:issue:`71`)
1617
- Improve errors with information about the current document (:issue:`71`)
1718

1819
0.6.0 (2021-11-21)

src/sphinx_codeautolink/parse.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,9 @@ def _resolve_assignment(self, assignment: Assignment):
292292
targets = assign.targets
293293

294294
for target in targets:
295+
if target is None:
296+
continue
297+
295298
if len(target.components) == 1:
296299
comp = Component.from_ast(target.components[0])
297300
self._overwrite(comp.name)

tests/parse/assign.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ def test_assign_uses_and_assigns_imported(self):
2323
refs = [('a', 'a'), ('a', 'a'), ('a', 'a')]
2424
return s, refs
2525

26+
@refs_equal
27+
def test_unpack_assign_starred(self):
28+
s = '*a, b = c'
29+
refs = []
30+
return s, refs
31+
2632
@refs_equal
2733
def test_unpack_assign_uses_and_overwrites(self):
2834
s = 'import a\na, b = a\na'

0 commit comments

Comments
 (0)