C API PyObject_GetAttrString returns <getset_descriptor> not the object I expected

Phil Thompson phil at riverbankcomputing.com
Sun Feb 10 08:22:34 EST 2019


On 10 Feb 2019, at 12:08 pm, Barry Scott <barry at barrys-emacs.org> wrote:
> 
> After calling PyObject_GetAttrString() I expected to get a PyObject string 
> back but I found that I had been given a <getset_description> instead.
> 
> (gdb) p *args_o 
> $4 = <getset_descriptor at remote 0x7fffea87c7e0>
> 
> What is going on and how do I get from the <getset_descriptor> to the object I 
> want?

The "String" part of "PyObject_GetAttrString()" refers to the way you provide the attribute name and not the type of the object returned.

Phil


More information about the Python-list mailing list