Closed jonringer closed 4 years ago
We need to fix the #247 first. After that fix Python 3.8 tests failing (#284).
Help on https://github.com/python-rope/rope/pull/283 first and we can move ahead.
@mcepl, how can I help? It looks like you wait for review...
@mcepl, how can I help? It looks like you wait for review...
Yes, thorough review (i.e., somebody really going behind and rethinking what stupid ideas I had) would be very helpful. I am a wee afraid just let this go in without anybody thinking about it.
I attempted the Quickstart: Make a Project as suggested:
import rope.base.project
myproject = = rope.base.project.Project('.')
which resulted in a similar issue identified by jonringer (see #277 above):
File "~/Library/Python/3.8/lib/python/site-packages/rope/base/pyobjects.py", line 224, in get_doc
isinstance(expr.value, ast.Str):
AttributeError: module 'rope.base.ast' has no attribute 'Str'
I suppose this is rather dangerous, but I added (+) the following code to the local copy of pyobjects.py
. My edit allow me to continue on and try out some of rope's features.
def get_doc(self):
if len(self.get_ast().body) > 0:
expr = self.get_ast().body[0]
+ try:
if isinstance(expr, ast.Expr) and isinstance(expr.value, ast.Str):
docstring = expr.value.s
coding = self.get_module().coding
return _decode_data(docstring, coding)
+ except AttributeError as e:
+ if hasattr(e, 'message'):
+ print(e.message)
+ else:
+ print(e)
@jonringer, can you reproduce with the latest master (commit d46aa2dcf34c6baf57b37930f5db7dc962b770b6)?
Running pytest -v
with latest master (commit d46aa2d
), using python 3.8.2, all tests pass for me:
For reference:
Thanks a lot.
Trying to run the test suite in python3.8 results in the following errors:
Test failures
``` ====================================================================== ERROR: test_changing_signature_for_constructors_when_using_super (ropetest.refactor.change_signature_test.ChangeSignatureTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/build/rope-0.14.0/ropetest/refactor/change_signature_test.py", line 403, in test_changing_signature_for_constructors_when_using_super signature.get_changes([change_signature.ArgumentRemover(1)]).do() File "/build/rope-0.14.0/rope/refactor/change_signature.py", line 140, in get_changes return self._change_calls(function_changer, in_hierarchy, File "/build/rope-0.14.0/rope/refactor/change_signature.py", line 65, in _change_calls changed_file = change_calls.get_changed_module() File "/build/rope-0.14.0/rope/refactor/change_signature.py", line 304, in get_changed_module for occurrence in self.occurrence_finder.find_occurrences( File "/build/rope-0.14.0/rope/refactor/change_signature.py", line 349, in find_occurrences all_occurrences.extend(finder.find_occurrences(resource, pymodule)) File "/build/rope-0.14.0/rope/refactor/occurrences.py", line 78, in find_occurrences result = filter(occurrence) File "/build/rope-0.14.0/rope/refactor/occurrences.py", line 215, in __call__ if same_pyname(self.pyname, occurrence.get_pyname()): File "/build/rope-0.14.0/rope/base/utils/__init__.py", line 12, in _wrapper setattr(self, name, func(self, *args, **kwds)) File "/build/rope-0.14.0/rope/refactor/occurrences.py", line 137, in get_pyname return self.tools.name_finder.get_pyname_at(self.offset) File "/build/rope-0.14.0/rope/base/evaluate.py", line 77, in get_pyname_at return self.get_primary_and_pyname_at(offset)[1] File "/build/rope-0.14.0/rope/base/evaluate.py", line 114, in get_primary_and_pyname_at return eval_str2(holding_scope, name) File "/build/rope-0.14.0/rope/base/evaluate.py", line 47, in eval_str2 return eval_node2(holding_scope, node) File "/build/rope-0.14.0/rope/base/evaluate.py", line 32, in eval_node2 ast.walk(node, evaluator) File "/build/rope-0.14.0/rope/base/ast.py", line 41, in walk walk(child, walker) File "/build/rope-0.14.0/rope/base/ast.py", line 41, in walk walk(child, walker) File "/build/rope-0.14.0/rope/base/ast.py", line 39, in walk return method(node) File "/build/rope-0.14.0/rope/base/evaluate.py", line 152, in _Attribute pyname = eval_node(self.scope, node.value) File "/build/rope-0.14.0/rope/base/evaluate.py", line 27, in eval_node return eval_node2(scope, node)[1] File "/build/rope-0.14.0/rope/base/evaluate.py", line 32, in eval_node2 ast.walk(node, evaluator) File "/build/rope-0.14.0/rope/base/ast.py", line 39, in walk return method(node) File "/build/rope-0.14.0/rope/base/evaluate.py", line 189, in _Call pyobject=_get_returned(pyfunction)) File "/build/rope-0.14.0/rope/base/evaluate.py", line 170, in _get_returned return pyobject.get_returned_object(args) File "/build/rope-0.14.0/rope/base/builtins.py", line 108, in get_returned_object return self.function(_CallContext(self.argnames, args)) File "/build/rope-0.14.0/rope/base/builtins.py", line 746, in _super_function passed_class, passed_self = args.get_arguments(['type', 'self']) File "/build/rope-0.14.0/rope/base/builtins.py", line 209, in get_arguments return self.args.get_arguments(argnames) File "/build/rope-0.14.0/rope/base/arguments.py", line 24, in get_arguments result.append(pyname.get_object()) File "/build/rope-0.14.0/rope/base/pynamesdef.py", line 42, in get_object result = self.pyfunction.get_parameter(self.index) File "/build/rope-0.14.0/rope/base/pyobjectsdef.py", line 69, in get_parameter if index < len(self.parameter_pyobjects.get()): File "/build/rope-0.14.0/rope/base/utils/__init__.py", line 29, in newfunc return func(self, *args, **kwds) File "/build/rope-0.14.0/rope/base/pynames.py", line 188, in get self.set(self.get_inferred(*args, **kwds)) File "/build/rope-0.14.0/rope/base/pyobjectsdef.py", line 40, in _infer_parameters pyobjects = rope.base.oi.soi.infer_parameter_objects(self) File "/build/rope-0.14.0/rope/base/utils/__init__.py", line 41, in newfunc return func(*args, **kwds) File "/build/rope-0.14.0/rope/base/oi/soi.py", line 47, in infer_parameter_objects result = _parameter_objects(pyfunction) File "/build/rope-0.14.0/rope/base/oi/soi.py", line 130, in _parameter_objects type_ = hint_param(pyobject, name) File "/build/rope-0.14.0/rope/base/oi/type_hinting/providers/inheritance.py", line 21, in __call__ result = self._delegate(superfunc, param_name) File "/build/rope-0.14.0/rope/base/oi/type_hinting/providers/composite.py", line 19, in __call__ result = delegate(pyfunc, param_name) File "/build/rope-0.14.0/rope/base/oi/type_hinting/providers/docstrings.py", line 46, in __call__ type_strs = self._parse_docstring(pyfunc.get_doc(), param_name) File "/build/rope-0.14.0/rope/base/pyobjects.py", line 224, in get_doc isinstance(expr.value, ast.Str): AttributeError: module 'rope.base.ast' has no attribute 'Str' -------------------- >> begin captured logging << -------------------- root: DEBUG: Using /dev/shm/sample_project as root of the project. --------------------- >> end captured logging << --------------------- ====================================================================== ERROR: test_static_oi_for_lists_per_object_for_fields (ropetest.advanced_oi_test.NewStaticOITest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/build/rope-0.14.0/ropetest/advanced_oi_test.py", line 515, in test_static_oi_for_lists_per_object_for_fields self.pycore.analyze_module(self.mod) File "/build/rope-0.14.0/rope/base/pycore.py", line 209, in analyze_module rope.base.oi.soa.analyze_module( File "/build/rope-0.14.0/rope/base/oi/soa.py", line 15, in analyze_module _analyze_node(pycore, pymodule, should_analyze, File "/build/rope-0.14.0/rope/base/oi/soa.py", line 23, in _analyze_node _analyze_node(pycore, scope.pyobject, should_analyze, File "/build/rope-0.14.0/rope/base/oi/soa.py", line 23, in _analyze_node _analyze_node(pycore, scope.pyobject, should_analyze, File "/build/rope-0.14.0/rope/base/oi/soa.py", line 38, in _analyze_node rope.base.ast.walk(child, visitor) File "/build/rope-0.14.0/rope/base/ast.py", line 41, in walk walk(child, walker) File "/build/rope-0.14.0/rope/base/ast.py", line 39, in walk return method(node) File "/build/rope-0.14.0/rope/base/oi/soa.py", line 58, in _Call primary, pyname = evaluate.eval_node2(self.scope, node.func) File "/build/rope-0.14.0/rope/base/evaluate.py", line 32, in eval_node2 ast.walk(node, evaluator) File "/build/rope-0.14.0/rope/base/ast.py", line 39, in walk return method(node) File "/build/rope-0.14.0/rope/base/evaluate.py", line 152, in _Attribute pyname = eval_node(self.scope, node.value) File "/build/rope-0.14.0/rope/base/evaluate.py", line 27, in eval_node return eval_node2(scope, node)[1] File "/build/rope-0.14.0/rope/base/evaluate.py", line 32, in eval_node2 ast.walk(node, evaluator) File "/build/rope-0.14.0/rope/base/ast.py", line 39, in walk return method(node) File "/build/rope-0.14.0/rope/base/evaluate.py", line 156, in _Attribute if pyname.get_object() != rope.base.pyobjects.get_unknown(): File "/build/rope-0.14.0/rope/base/pynamesdef.py", line 42, in get_object result = self.pyfunction.get_parameter(self.index) File "/build/rope-0.14.0/rope/base/pyobjectsdef.py", line 69, in get_parameter if index < len(self.parameter_pyobjects.get()): File "/build/rope-0.14.0/rope/base/utils/__init__.py", line 29, in newfunc return func(self, *args, **kwds) File "/build/rope-0.14.0/rope/base/pynames.py", line 188, in get self.set(self.get_inferred(*args, **kwds)) File "/build/rope-0.14.0/rope/base/pyobjectsdef.py", line 40, in _infer_parameters pyobjects = rope.base.oi.soi.infer_parameter_objects(self) File "/build/rope-0.14.0/rope/base/utils/__init__.py", line 41, in newfunc return func(*args, **kwds) File "/build/rope-0.14.0/rope/base/oi/soi.py", line 47, in infer_parameter_objects result = _parameter_objects(pyfunction) File "/build/rope-0.14.0/rope/base/oi/soi.py", line 130, in _parameter_objects type_ = hint_param(pyobject, name) File "/build/rope-0.14.0/rope/base/oi/type_hinting/providers/inheritance.py", line 21, in __call__ result = self._delegate(superfunc, param_name) File "/build/rope-0.14.0/rope/base/oi/type_hinting/providers/composite.py", line 19, in __call__ result = delegate(pyfunc, param_name) File "/build/rope-0.14.0/rope/base/oi/type_hinting/providers/docstrings.py", line 46, in __call__ type_strs = self._parse_docstring(pyfunc.get_doc(), param_name) File "/build/rope-0.14.0/rope/base/pyobjects.py", line 224, in get_doc isinstance(expr.value, ast.Str): AttributeError: module 'rope.base.ast' has no attribute 'Str' -------------------- >> begin captured logging << -------------------- root: DEBUG: Using /dev/shm/sample_project as root of the project. --------------------- >> end captured logging << --------------------- ====================================================================== FAIL: test_textual_transformations (ropetest.advanced_oi_test.DynamicOITest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/build/rope-0.14.0/ropetest/advanced_oi_test.py", line 241, in test_textual_transformations self.assertEquals(to_textual.transform(var), AssertionError: Tuples differ: ('unknown',) != ('none',) First differing element 0: 'unknown' 'none' - ('unknown',) ? --- - + ('none',) ? + -------------------- >> begin captured logging << -------------------- root: DEBUG: Using /dev/shm/sample_project as root of the project. --------------------- >> end captured logging << --------------------- ====================================================================== FAIL: test_call_function_and_parameters (ropetest.advanced_oi_test.NewStaticOITest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/build/rope-0.14.0/ropetest/advanced_oi_test.py", line 674, in test_call_function_and_parameters self.assertTrue(isinstance(p_object.get_type(), AssertionError: False is not true -------------------- >> begin captured logging << -------------------- root: DEBUG: Using /dev/shm/sample_project as root of the project. --------------------- >> end captured logging << --------------------- ---------------------------------------------------------------------- Ran 100 tests in 1.689s FAILED (SKIP=2, errors=2, failures=2) builder for '/nix/store/y6ngan74xq6vvy04arf13xir33cpkf0v-python3.8-rope-0.14.0.drv' failed with exit code 1 error: build of '/nix/store/y6ngan74xq6vvy04arf13xir33cpkf0v-python3.8-rope-0.14.0.drv' failed ```