Menu

#8 Cannot inspect heap when using psyco

open
nobody
None
5
2009-09-04
2009-09-04
Anonymous
No

When I try to inspect the heap after calling psyco.full(), I get an error. For example:

Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41)
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import psyco, guppy
>>> x = 1
>>> psyco.full()
>>> guppy.hpy().heap()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.6/dist-packages/guppy/heapy/Use.py", line 188, in heap
h = self.View.heap()
File "/usr/local/lib/python2.6/dist-packages/guppy/heapy/View.py", line 354, in heap
repr(self.idset(self.hv.heap()))
File "/usr/local/lib/python2.6/dist-packages/guppy/heapy/UniSet.py", line 171, in __repr__
return self.fam.c_repr(self)
File "/usr/local/lib/python2.6/dist-packages/guppy/heapy/UniSet.py", line 859, in c_repr
return self.c_str(a)
File "/usr/local/lib/python2.6/dist-packages/guppy/heapy/UniSet.py", line 1616, in c_str
a.fam.get_partition(a).ppob(ob)
File "/usr/local/lib/python2.6/dist-packages/guppy/heapy/UniSet.py", line 1704, in get_partition
p = a.fam.Part.partition(a, a.er)
File "/usr/local/lib/python2.6/dist-packages/guppy/heapy/UniSet.py", line 74, in __getattr__
return self.fam.mod.View.enter(lambda:self.fam.c_getattr(self, other))
File "/usr/local/lib/python2.6/dist-packages/guppy/heapy/View.py", line 250, in enter
limitframe = traceback.tb_frame.f_back.f_back
AttributeError: 'NoneType' object has no attribute 'f_back'

Here's what happens if I don't call psyco.full():
Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41)
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import psyco, guppy
>>> x = 1
>>> guppy.hpy().heap()
Partition of a set of 26546 objects. Total size = 1883140 bytes.
Index Count % Size % Cumulative % Kind (class / dict of class)
0 11351 43 755832 40 755832 40 str
1 5819 22 216332 11 972164 52 tuple
2 348 1 116448 6 1088612 58 dict (no owner)
3 73 0 113608 6 1202220 64 dict of module
4 1574 6 107032 6 1309252 70 types.CodeType
5 178 1 93712 5 1402964 75 dict of type
6 198 1 87808 5 1490772 79 type
7 1500 6 84000 4 1574772 84 function
8 128 0 69248 4 1644020 87 dict of class
9 1031 4 37116 2 1681136 89 __builtin__.wrapper_descriptor
<90 more rows. Type e.g. '_.more' to view.>

One solution is just to print a warning message if psyco is running.

My system: Linux 2.6.28-15-generic Ubuntu 9.04 i686 GNU/Linux.

Thanks!

Discussion


Log in to post a comment.

MongoDB Logo MongoDB