Re: [python-cffi] How to get the raw cffi pointer from the cffi object?

15 views
Skip to first unread message

Armin Rigo

unread,
Jan 3, 2018, 12:28:55 PM1/3/18
to pytho...@googlegroups.com
Hi,

On 2 January 2018 at 20:37, Yuri Vic <yuri...@gmail.com> wrote:
> 'dir(obj.is_a_function().in_ptr())` prints '[]', like it has no methods.
>
> So how do I determine that this pointer is null or not null then?

Like in C, the cdata objects don't answer to regular methods like
``is_null()``, but to operators, at least the ones that exist both in
C and Python. In this case, it's equality: you can ask if ``cdata ==
ffi.NULL``. Or equivalently, truth value: ``if not cdata:``.


A bientôt,

Armin.
Reply all
Reply to author
Forward
0 new messages