This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFC - Python Scripting] Unnecessary Py_XINCREF?


Hello,

I find something which to my understanding looks like an unnecessary
Py_XINCREF in py-symtab.c:stpy_get_objfile. I support it by this
experiment:

Load any program and do the following:

python
import sys
print sys.getrefcount(gdb.lookup_global_symbol("main").symtab.objfile)
end

The above Python snippet prints 2 without the patch applied. With the
patch applied, it prints 1 which I think is what it should be. Am I
missing something (real bad) here?

ChangeLog:

2012-03-28  Siva Chandra Reddy  <sivachandra@google.com>

        * python/py-symtab.c (stpy_get_objfile): Remove the unnecessary
        Py_XINCREF.

Thanks,
Siva Chandra

Attachment: refcount_patch.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]