You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The method daast_from_str(filename, args=None) in parser.py initializes Parser with filename and optional args. The args are used as options in initialization of Resolver. Initializing Parser without the optional args throws the following error during initialization of Resolver: options does not have attribute module_name.
To fix this, we have modified the method daast_from_str as follows:
We have created an option parameter and passed it as the argument to constructor of Parser.
"""Generates DistAlgo AST from source string.
'src' is the DistAlgo source string to parse. Optional argument 'filename'
specifies the filename that appears in error messages, defaults to
'<str>'. Optional argument 'args' is a Namespace object containing the
command line parameters for the compiler. Returns the generated DistAlgo
AST.
"""
try:
options = Namespace()
options.benchmark=False
options.debug=None
options.dump_ast=False
options.geninc=False
options.genpsd=False
options.incfile=None,
options.infile=filename
options.interactive=False
options.module_name='__main__'
options.optimize=-1
options.outfile=None
options.psdfile=None
options.write_bytecode=False
# dt = Parser(filename, args)
dt = Parser(filename, options)
rawast = parse(src, filename)
dt.visit(rawast)
sys.stderr.write("%s compiled with %d errors and %d warnings.\n" %
(filename, dt.errcnt, dt.warncnt))
if dt.errcnt == 0:
return dt.program
except SyntaxError as e:
sys.stderr.write("%s:%d:%d: SyntaxError: %s" % (e.filename, e.lineno,
e.offset, e.text))
return None`
The text was updated successfully, but these errors were encountered:
if this is the correct fix, please incorporate it in the master branch (or tell us it is OK, and we will do that). if this is not the correct fix, please tell us what is. our program that prints a DistAlgo AST as a DistAlgo program relies on this fix. thanks! --scott
The method
daast_from_str(filename, args=None)
inparser.py
initializesParser
withfilename
and optionalargs
. Theargs
are used asoptions
in initialization ofResolver
. InitializingParser
without the optionalargs
throws the following error during initialization ofResolver
:options does not have attribute module_name
.To fix this, we have modified the method
daast_from_str
as follows:We have created an
option
parameter and passed it as the argument to constructor ofParser
.The text was updated successfully, but these errors were encountered: