def getsource(self, astcache=None):
<EOL>from _pytest._code.source import getstatementrange_ast<EOL>source = self.frame.code.fullsource<EOL>if source is None:<EOL><INDENT>return None<EOL><DEDENT>key = astnode = None<EOL>if astcache is not None:<EOL><INDENT>key = self.frame.code.path<EOL>if key is not None:<EOL><INDENT>astnode = astcache.get(key, None)<EOL><DEDENT><DEDENT>start = self.getfirstlinesource()<EOL>try:<EOL><INDENT>astnode, _, end = getstatementrange_ast(<EOL>self.lineno, source, astnode=astnode<EOL>)<EOL><DEDENT>except SyntaxError:<EOL><INDENT>end = self.lineno + <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>if key is not None:<EOL><INDENT>astcache[key] = astnode<EOL><DEDENT><DEDENT>return source[start:end]<EOL>
return failing source code.