Re: [libgpiod][PATCH] bindings: python: replace PyModule_AddObjectRef() with PyModule_AddObjectRef()

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

 



On Mon, Oct 9, 2023 at 11:00 PM Phil Howard <phil@xxxxxxxxxxxxx> wrote:
>
> On Mon, 9 Oct 2023 at 20:07, Bartosz Golaszewski <brgl@xxxxxxxx> wrote:
> >
> > From: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx>
> >
> > PyModule_AddObjectRef() was added in cpython v3.10 while libgpiod claims
> > to depend on python v3.9. Replace it with an older variant that steals the
> > reference to the added object on success.
>
> Ah, fixing this makes much more sense than bumping the dependent
> version, thank you, I will update my patch.
>

And of course the commit message was supposed to read: "bindings:
python: replace PyModule_AddObjectRef() with PyModule_AddObject()".

I'll fix it when applying.

Bart

> >
> > Reported-by: Phil Howard <phil@xxxxxxxxxxxxx>
> > Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx>
> > ---
> >  bindings/python/gpiod/ext/module.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/bindings/python/gpiod/ext/module.c b/bindings/python/gpiod/ext/module.c
> > index 25c252a..b456190 100644
> > --- a/bindings/python/gpiod/ext/module.c
> > +++ b/bindings/python/gpiod/ext/module.c
> > @@ -178,9 +178,9 @@ PyMODINIT_FUNC PyInit__ext(void)
> >                 return NULL;
> >         }
> >
> > -       ret = PyModule_AddObjectRef(module, "__all__", all);
> > -       Py_DECREF(all);
> > +       ret = PyModule_AddObject(module, "__all__", all);
> >         if (ret) {
> > +               Py_DECREF(all);
> >                 Py_DECREF(module);
> >                 return NULL;
> >         }
> > --
> > 2.39.2
> >




[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