Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def on_return(self, node): # ('value',)
"""Return statement: look for None, return special sentinal."""
self.retval = self.run(node.value)
if self.retval is None:
self.retval = ReturnedNone
return
self.raise_exc(None, msg=msg, lineno=self.lineno)
save_symtable = self.__asteval__.symtable.copy()
self.__asteval__.symtable.update(symlocals)
self.__asteval__.retval = None
retval = None
# evaluate script of function
for node in self.body:
self.__asteval__.run(node, expr='<>', lineno=self.lineno)
if len(self.__asteval__.error) > 0:
break
if self.__asteval__.retval is not None:
retval = self.__asteval__.retval
self.__asteval__.retval = None
if retval is ReturnedNone:
retval = None
break
self.__asteval__.symtable = save_symtable
symlocals = None
return retval