Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#68 psyco prevents traceback.print_stack

open
nobody
None
5
2006-07-20
2006-07-20
Greg Hazel
No

Win XP, python 2.4.3:

import traceback

def foo():
print 'see'
traceback.print_stack()
print 'nothing'

def bar():
print 'see'
traceback.print_stack()
print 'something'

import psyco
psyco.bind(foo)

foo()
print '-' * 79
bar()

#### produces:
see
nothing
-------------------------------------------------------
-----------------------
see
File "test.py", line 18, in ?
bar()
File "test.py", line 10, in bar
traceback.print_stack()
something

Discussion

  • Armin Rigo
    Armin Rigo
    2006-07-21

    Logged In: YES
    user_id=4771

    traceback.py uses sys.exc_info() in a strange way to get
    at the current frame. In particular, reading the f_back
    attribute of frames is not supported in Psyco, which is
    why it fails. A work-around is to prevent Psyco from
    compiling traceback.print_stack() by adding the following
    line after 'import psyco':

    psyco.cannotcompile(traceback.print_stack)