method: code.Source.compile

 return compiled code object. if filename is None
            invent an artificial filename which displays
            the source/line position of the caller frame.
        
    def compile(self, filename=None, mode='exec',

origin: code.Source

where:

exceptions that might appear during execution:

function source:

def compile(self, filename=None, mode='exec',
            flag=generators.compiler_flag, dont_inherit=0):
    """ return compiled code object. if filename is None
            invent an artificial filename which displays
            the source/line position of the caller frame.
        """
    if not filename or py.path.local(filename).check(file=0): 
        frame = sys._getframe(1) # the caller
        filename = '%s<%s:%d>' % (filename, frame.f_code.co_filename,
                                  frame.f_lineno)
    source = "\n".join(self.lines) + '\n'
    try:
        co = cpy_compile(source, filename, mode, flag)
    except SyntaxError, ex:
        # re-represent syntax errors from parsing python strings
        msglines = self.lines[:ex.lineno]
        if ex.offset:
            msglines.append(" "*ex.offset + '^')
        msglines.append("syntax error probably generated here: %s" % filename)
        newex = SyntaxError('\n'.join(msglines))
        newex.offset = ex.offset
        newex.lineno = ex.lineno
        newex.text = ex.text
        raise newex
    else:
        co_filename = MyStr(filename)
        co_filename.__source__ = self
        return py.code.Code(co).new(rec=1, co_filename=co_filename) 

call sites:

called in /home/johnny/projects/merlinux/py/dist/py/code/source.py

traceback code.Source.compile.0

called in /home/johnny/projects/merlinux/py/dist/py/test/raises.py

traceback code.Source.compile.1

called in /home/johnny/projects/merlinux/py/dist/py/test/raises.py

traceback code.Source.compile.2

called in /home/johnny/projects/merlinux/py/dist/py/code/source.py

traceback code.Source.compile.3

called in /home/johnny/projects/merlinux/py/dist/py/code/source.py

traceback code.Source.compile.4

called in /home/johnny/projects/merlinux/py/dist/py/test/raises.py

traceback code.Source.compile.5

called in /home/johnny/projects/merlinux/py/dist/py/test/raises.py

traceback code.Source.compile.6

called in /home/johnny/projects/merlinux/py/dist/py/test/raises.py

traceback code.Source.compile.7

called in /home/johnny/projects/merlinux/py/dist/py/code/testing/test_excinfo.py

traceback code.Source.compile.8

called in /home/johnny/projects/merlinux/py/dist/py/test/raises.py

traceback code.Source.compile.9

called in /home/johnny/projects/merlinux/py/dist/py/code/source.py

traceback code.Source.compile.10

called in /home/johnny/projects/merlinux/py/dist/py/test/raises.py

traceback code.Source.compile.11

called in /home/johnny/projects/merlinux/py/dist/py/code/source.py

traceback code.Source.compile.12

called in /home/johnny/projects/merlinux/py/dist/py/test/raises.py

traceback code.Source.compile.13

called in /home/johnny/projects/merlinux/py/dist/py/test/raises.py

traceback code.Source.compile.14

called in /home/johnny/projects/merlinux/py/dist/py/test/raises.py

traceback code.Source.compile.15

called in /home/johnny/projects/merlinux/py/dist/py/test/raises.py

traceback code.Source.compile.16

called in /home/johnny/projects/merlinux/py/dist/py/code/testing/test_source.py

traceback code.Source.compile.17

called in /home/johnny/projects/merlinux/py/dist/py/test/raises.py

traceback code.Source.compile.18

called in /home/johnny/projects/merlinux/py/dist/py/code/source.py

traceback code.Source.compile.19

called in /home/johnny/projects/merlinux/py/dist/py/code/source.py

traceback code.Source.compile.20