Skip to content

Commit

Permalink
Use astwrapper.parse, not ast.parse in PyModule._init_source
Browse files Browse the repository at this point in the history
  • Loading branch information
edreamleo committed Dec 9, 2022
1 parent e565a5a commit 4242dc9
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions rope/base/pyobjectsdef.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@
import rope.base.oi.soi
import rope.base.pyscopes
from rope.base import (
pynamesdef,
exceptions,
arguments,
ast,
astutils,
pyobjects,
exceptions,
fscommands,
arguments,
pynamesdef,
pyobjects,
utils,
)
from rope.base.astwrapper import parse


class PyFunction(pyobjects.PyFunction):
Expand Down Expand Up @@ -197,7 +198,7 @@ def _init_source(self, pycore, source_code, resource):
source_bytes = fscommands.unicode_to_file_data(source_code)
else:
source_bytes = source_code
ast_node = ast.parse(source_bytes, filename=filename)
ast_node = parse(source_bytes, filename=filename)
except SyntaxError as e:
raise exceptions.ModuleSyntaxError(filename, e.lineno, e.msg)
except UnicodeDecodeError as e:
Expand Down

0 comments on commit 4242dc9

Please sign in to comment.