This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 1/2] python: disallow python code to instanciate certain types
- From: Tom Tromey <tromey at redhat dot com>
- To: Phil Muldoon <pmuldoon at redhat dot com>
- Cc: Sanimir Agovic <sanimir dot agovic at intel dot com>, gdb-patches at sourceware dot org
- Date: Thu, 10 Oct 2013 13:08:21 -0600
- Subject: Re: [PATCH 1/2] python: disallow python code to instanciate certain types
- Authentication-results: sourceware.org; auth=none
- References: <1377873604-15519-1-git-send-email-sanimir dot agovic at intel dot com> <1377873604-15519-2-git-send-email-sanimir dot agovic at intel dot com> <5220B578 dot 6030100 at redhat dot com>
>> -static PyObject *
>> -objfpy_new (PyTypeObject *type, PyObject *args, PyObject *keywords)
[...]
Phil> In removing this function, you are removing the instantiation of
Phil> self-> printers (Which is needed for pretty-printers),
Phil> self-> frame-filters (for frame filters) and self->type_printers (for
Phil> type printers). If this is the case, and I have not missed an
Phil> equivalent instantiation somewhere else, you will have an
Phil> uninitialized PyObject for each of the above and likely will result in
Phil> a crash?
Internal instantiations don't go through tp_new. instead they use
PyObject_New.
In the case of objfile these fields are initialized in
objfile_to_objfile_object.
>> -static PyObject *
>> -pspy_new (PyTypeObject *type, PyObject *args, PyObject *keywords)
Phil> Ditto, same with object files above.
This is handled in pspace_to_pspace_object.
Tom