Re: [PATCH libgpiod] bindings: python: fix Line.request() crashing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Oct 9, 2020 at 11:20 AM Jiri Benc <jbenc@xxxxxxx> wrote:
>
> On Fri, 9 Oct 2020 09:40:29 +0200, Bartosz Golaszewski wrote:
> > Thanks for the fixes. Could you send me a chunk of code that triggers
> > this error so I can make a test-case for it?
>
> It was as simple as this:
>
> import gpiod
> c = gpiod.Chip('0')
> l = c.get_line(17)
> l.request('my')
>
> Latest stable Raspbian (Debian 10.6), Python 3.7.3. It's so basic that
> it's puzzling me that nobody has hit it before me. But my patch is
> right, see https://docs.python.org/3/c-api/structures.html:
>
> ------
> METH_VARARGS | METH_KEYWORDS
>
> Methods with these flags must be of type PyCFunctionWithKeywords. The
> function expects three parameters: self, args, kwargs where kwargs is a
> dictionary of all the keyword arguments or possibly NULL if there are
> no keyword arguments.
> ------
>
> Yet, commit 02a3d0a2ab5e that attempted to fix this states that the
> kwds dictionary was an empty dict. Maybe a change in Python C API in
> 3.7? The Python 3.6 and earlier documentation did not mention the NULL.
> I can't find anything in Python release notes, though.
>
>  Jiri

Thanks. I added a test-case for this and applied your patch to master
and stable v1.6 & 1.4.

Bartosz



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux