Duncan Booth wrote:
> John Nagle <[EMAIL PROTECTED]> wrote:
> 
>> I'm printing out each entry in "gc.garbage" after a garbage collection in
>> DEBUG_LEAK mode, and I'm seeing many entries like
>>
>> <cell at 0x00F7C170: function object at 0x00FDD6B0>
>>
>> That's the output of "repr".   Are "cell" objects created only from
>> external C libraries, or can regular Python code generate them?  Is there
>> any way to find out what the 'function object' is from within Python?
>>
> Cell objects are created whenever you have a function that references a 
> variable in an outer scope. e.g.
> 
> So in your case, cell.cell_contents.func_name might help.

    Tried that:

                        print repr(item).encode('ascii','replace')      
                        print "Type:",type(item)
                        try:
                                print item.cell_contents
                        except Exception, message:
                                print "Unprintable:",message

<cell at 0x00F88DF0: function object at 0x0100CFB0>
Type: <type 'cell'>
Unprintable: 'cell' object has no attribute 'cell_contents'

So it doesn't have a "cell_contents" attribute.

Tried:
        print item.dir()
got:
        'cell' object has no attribute 'dir'

Tried:
        print item.__dict__
got:
        'cell' object has no attribute '__dict__'

It looks like this is a low-level PyCellObject not generated from Python code.
Any ideas?  I'm using the M2Crypto and MySQLdb libraries, and suspect
a reference count bug in one of those.

                                        John Nagle
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to