[py-dev] confusion on traceback.cut

Ronny Pfannschmidt Ronny.Pfannschmidt at gmx.de
Sun Jan 17 22:27:54 CET 2010


Hi,
just played around with traceback cut/filter
but i don't understand whats happening here:

        >>> import py
        >>> py._pydir
        local('/home/ronny/Projects/py/py')
        >>> e = py.test.raises(ValueError, "int('a')")
        >>> tb = e.traceback
        >>> tb.cut(excludepath=py._pydir)
        [<TracebackEntry /home/ronny/Projects/py/py/_test/outcome.py:89>, <TracebackEntry /home/ronny/Projects/py/py/_builtin.py:179>, <TracebackEntry <string>:5>, <TracebackEntry <codegen /home/ronny/Projects/py/py/_test/outcome.py:88>:1>]


i expected it to remove the first few items

on the other hand
        >>> tb.filter(lambda x:not
        py.path.local(x.path).relto(py._pydir))
        [<TracebackEntry <string>:5>, <TracebackEntry
        <codegen /home/ronny/Projects/py/py/_test/outcome.py:88>:1>]
        
seems to do exactly that and i expected it to filter the last entry, too

can we please clarify what each of those really.

ps:
        ~/Projects/py $ hg id
        201d526c373c (trunk) tip

Regards Ronny




More information about the py-dev mailing list