donkirkby / live-py-plugin

Live coding in Python with PyCharm, Emacs, Sublime Text, or even a browser
https://donkirkby.github.io/live-py-plugin
MIT License
292 stars 56 forks source link

AssertionError: Assignment target had type <class '_ast.Starred'>. #115

Closed dalum closed 7 years ago

dalum commented 7 years ago

live-py-mode fails with the following error:

----------------------------------------------------------------------------------------------------------------- | 
Traceback (most recent call last):                                                                                | 
  File "/usr/lib/python3.6/ast.py", line 253, in visit                                                            | 
    return visitor(node)                                                                                          | 
  File "/home/sasi/.emacs.d/elpa/live-py-mode-20170326.934/code_tracer.py", line 489, in visit_Module             | 
    new_node = self.generic_visit(node)                                                                           | 
  File "/usr/lib/python3.6/ast.py", line 308, in generic_visit                                                    | 
    value = self.visit(value)                                                                                     | 
  File "/home/sasi/.emacs.d/elpa/live-py-mode-20170326.934/code_tracer.py", line 72, in visit                     | 
    new_node = super(Tracer, self).visit(node)                                                                    | 
  File "/usr/lib/python3.6/ast.py", line 253, in visit                                                            | 
    return visitor(node)                                                                                          | 
  File "/home/sasi/.emacs.d/elpa/live-py-mode-20170326.934/code_tracer.py", line 307, in visit_Assign             | 
    existing_node.targets)                                                                                        | 
  File "/home/sasi/.emacs.d/elpa/live-py-mode-20170326.934/code_tracer.py", line 651, in _wrap_assignment_targets | 
    format_text = self._wrap_assignment_target(target)                                                            | 
  File "/home/sasi/.emacs.d/elpa/live-py-mode-20170326.934/code_tracer.py", line 636, in _wrap_assignment_target  | 
    return '({})'.format(', '.join(target_names))                                                                 | 
  File "/home/sasi/.emacs.d/elpa/live-py-mode-20170326.934/code_tracer.py", line 638, in _wrap_assignment_target  | 
    assert isinstance(target, Attribute), assert_message                                                          | 
AssertionError: Assignment target had type <class '_ast.Starred'>.                                                | 
----------------------------------------------------------------------------------------------------------------- | 

upon encountering expressions of the type:

*a, x = [0, 1, 2]

This happened both in an older version and the latest version from the Emacs repository.

dalum commented 7 years ago

Turned out to be a very simple two-line fix. Opened a pull request.