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

Rope 0.9.3 barfs on set-expressions #17

Closed
mcepl opened this issue Nov 30, 2013 · 3 comments
Closed

Rope 0.9.3 barfs on set-expressions #17

mcepl opened this issue Nov 30, 2013 · 3 comments

Comments

@mcepl
Copy link
Contributor

mcepl commented Nov 30, 2013

When using Python 2.7.1, and trying to rename a method, a ModuleSyntaxError is thrown.

Traceback (most recent call last):
  File "/Users/mahmoud/.emacs.d/languages/python/ropemode/decorators.py", line 53, in newfunc
    return func(*args, **kwds)
  File "/Users/mahmoud/.emacs.d/languages/python/ropemode/interface.py", line 52, in do_refactor
    refactoring(self, self.env).show(initial_asking=initial_asking)
  File "/Users/mahmoud/.emacs.d/languages/python/ropemode/refactor.py", line 43, in show
    changes = runtask(self.env, calculate, name=name)
  File "/Users/mahmoud/.emacs.d/languages/python/ropemode/refactor.py", line 469, in runtask
    return RunTask(env, command, name, interrupts)()
  File "/Users/mahmoud/.emacs.d/languages/python/ropemode/refactor.py", line 489, in __call__
    result = self.task(handle)
  File "/Users/mahmoud/.emacs.d/languages/python/ropemode/refactor.py", line 41, in calculate
    return self._calculate_changes(result, handle)
  File "/Users/mahmoud/.emacs.d/languages/python/ropemode/refactor.py", line 122, in _calculate_changes
    return self.renamer.get_changes(task_handle=task_handle, **values)
  File "/Users/mahmoud/.emacs.d/languages/python/rope/refactor/rename.py", line 95, in get_changes
    new_content = rename_in_module(finder, new_name, resource=file_)
  File "/Users/mahmoud/.emacs.d/languages/python/rope/refactor/rename.py", line 192, in rename_in_module
    for occurrence in occurrences_finder.find_occurrences(resource, pymodule):
  File "/Users/mahmoud/.emacs.d/languages/python/rope/refactor/occurrences.py", line 36, in find_occurrences
    result = filter(occurrence)
  File "/Users/mahmoud/.emacs.d/languages/python/rope/refactor/occurrences.py", line 160, in __call__
    if same_pyname(self.pyname, occurrence.get_pyname()):
  File "/Users/mahmoud/.emacs.d/languages/python/rope/base/utils.py", line 10, in _wrapper
    setattr(self, name, func(self, *args, **kwds))
  File "/Users/mahmoud/.emacs.d/languages/python/rope/refactor/occurrences.py", line 92, in get_pyname
    return self.tools.name_finder.get_pyname_at(self.offset)
  File "/Users/mahmoud/.emacs.d/languages/python/rope/base/utils.py", line 10, in _wrapper
    setattr(self, name, func(self, *args, **kwds))
  File "/Users/mahmoud/.emacs.d/languages/python/rope/refactor/occurrences.py", line 306, in name_finder
    return evaluate.ScopeNameFinder(self.pymodule)
  File "/Users/mahmoud/.emacs.d/languages/python/rope/base/utils.py", line 10, in _wrapper
    setattr(self, name, func(self, *args, **kwds))
  File "/Users/mahmoud/.emacs.d/languages/python/rope/refactor/occurrences.py", line 334, in pymodule
    return self.pycore.resource_to_pyobject(self.resource)
  File "/Users/mahmoud/.emacs.d/languages/python/rope/base/pycore.py", line 194, in resource_to_pyobject
    return self.module_cache.get_pymodule(resource, force_errors)
  File "/Users/mahmoud/.emacs.d/languages/python/rope/base/pycore.py", line 320, in get_pymodule
    force_errors=force_errors)
  File "/Users/mahmoud/.emacs.d/languages/python/rope/base/pyobjectsdef.py", line 152, in __init__
    source, node = self._init_source(pycore, source, resource)
  File "/Users/mahmoud/.emacs.d/languages/python/rope/base/pyobjectsdef.py", line 180, in _init_source
    raise exceptions.ModuleSyntaxError(filename, e.lineno, e.msg)
ModuleSyntaxError: Syntax error in file <tests/integration/controllers/test_users.py> line <272>: invalid syntax

When going to look at line 272 in test_users.py, it is a simple test case that's using set-expressions. I am documenting this here but I will most likely get around to either submitting a fix.

class TestUserControllerIndex(self):
    def setUp(self):
          self.user = make_user_fixture()

    def test_user_scores(self):
          self.assertEqual({score.id for score in self.user.scores}, {1})   # barfs here.
@mcepl
Copy link
Contributor Author

mcepl commented Nov 30, 2013

It also barfs on dict comprehensions.

@mcepl
Copy link
Contributor Author

mcepl commented Dec 18, 2014

This is actually set, not dict. PALMFACE

@mcepl
Copy link
Contributor Author

mcepl commented Nov 6, 2015

Fixed either by #129 or in dc1cb01. Please, reopen if it is not the case.

@mcepl mcepl closed this as completed Nov 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant