This is the mail archive of the 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]

Re: [patch] [python] PR python/15461 (gate architecture calls)

On 28/08/13 19:13, wrote:
> On Aug 28, 2013, at 1:54 PM, Tom Tromey <> wrote:
>> Phil> Something I thought about is not allowing gdb.Architecture to be
>> Phil> instantiated directly, but I could not think of a clean way to do
>> Phil> this.
>> Did you think of any way?
>> It seems like a good thing to prevent.
> Ditto for all the existing types for which direct instantiation doesn't do anything useful.
> I haven't tried this, but judging from the Python docs, if you point the tp_new field of the type object to a function that sets a suitable Python exception, that should do the job.

I was not able to make the tp_new call figure out where it was being
instantiated from.

So I could not tell the difference between:

foo = gdb.selected_frame()


foo = gdb.Frame()

There is a way if the class constructor takes arguments (ie, foo =
gdb.Value(2), but that case is valid in any case).

But I only spent a very brief time on it.  I am sure there is a way to
do it.  I will look at it in a little more detail now we think we
should make this happen.



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