[IPython-user] IPython and psyco

David J. C. Beach beach at verinet.com
Mon May 17 12:02:31 CDT 2004

On Mon, 2004-05-17 at 12:51, Fernando Perez wrote:
> Thorsten Kampe wrote:
> > There's been a lot of talk how psyco can speed up one's code without a
> > code change. I tried it today (psyco 1.1.1 and 1.2) with Python 2.3 in
> > IPython 0.5 and 0.6 under Cygwin and Gentoo Linux: IPython crashes
> > badly everytime (even while assigning a string to a variable). Not
> > even a crash report is generated. - Default Python shell runs without
> > a problem.
> > 
> > Has anyone ever made IPython interact with psyco?
> I've never tried.  Seeing how ipython is pure python code (no C extensions in 
> there), I honestly don't know why it wouldn't work 'out of the box'.  Psyco is 
> dark, black magic, so I suggest you take the issue up with the psyco wizards. 
>     If any of the failures is due to an ipython bug, I'll gladly fix it, of 
> course.

I've tried IPython with psyco... and I've seen it fail.  I believe the
reason is that IPython tries to look at the stack frames
(sys._getframe), but once Psyco compiles a certain function, that frame
object may no longer be available.

My best advice for using psyco within IPython is:

(1) don't use psyco.full(), and
(2) explicitly tell psyco which functions to specialize (optimize)

(2) should prevent psyco from trying to optimize IPython's internals
(which there is little point in doing, anyway) if it is used properly.


David J. C. Beach
<beach at verinet.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://projects.scipy.org/pipermail/ipython-user/attachments/20040517/9acfd63b/attachment-0002.bin 

More information about the IPython-user mailing list