linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
To: Phil Howard <phil@gadgetoid.com>
Cc: Bartosz Golaszewski <brgl@bgdev.pl>,
	Kent Gibson <warthog618@gmail.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	Erik Schilling <erik.schilling@linaro.org>,
	linux-gpio@vger.kernel.org
Subject: Re: [libgpiod][PATCH] bindings: python: replace PyModule_AddObjectRef() with PyModule_AddObjectRef()
Date: Tue, 10 Oct 2023 12:01:21 +0200	[thread overview]
Message-ID: <CACMJSeuXd1OSnjmM2Z6MnJOm=rCYJQ1EtYKM5BjrzjhmyFEurg@mail.gmail.com> (raw)
In-Reply-To: <CA+kSVo-0XroiBgiGHkk9SfKsWsW-_rsqd1MxuL=bVcydbxfFew@mail.gmail.com>

On Tue, 10 Oct 2023 at 11:50, Phil Howard <phil@gadgetoid.com> wrote:
>
> On Tue, 10 Oct 2023 at 07:31, Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> >
> > On Mon, Oct 9, 2023 at 11:00 PM Phil Howard <phil@gadgetoid.com> wrote:
> > >
> > > On Mon, 9 Oct 2023 at 20:07, Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> > > >
> > > > From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> > > >
> > > > 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
>
> I've done some digging and it looks like "PyModule_AddType" [1] helper
> function is what's
> anchoring the library to Python 3.9 (in the stable ABI as of 3.10)
> rather than 3.8.
>
> Is that correct? If so I'll update my patch to reflect the use of
> PyModule_AddType.
>
> The raw Python part of the library is compatible back to 3.7 (EOL),
> 3.8 EOL is this time next year so going < 3.9 is probably not worth the effort.
>

Agreed, and most distros ship >=v3.9 anyway.

Bart

> 1. https://github.com/python/cpython/blob/43a6e4fa4934fcc0cbd83f7f3dc1b23a5f79f24b/Python/modsupport.c#L686-L703
>
> > > > 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@gadgetoid.com>
> > > > Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> > > > ---
> > > >  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
> > > >

      reply	other threads:[~2023-10-10 10:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-09 19:07 [libgpiod][PATCH] bindings: python: replace PyModule_AddObjectRef() with PyModule_AddObjectRef() Bartosz Golaszewski
2023-10-09 20:59 ` Phil Howard
2023-10-10  6:31   ` Bartosz Golaszewski
2023-10-10  9:50     ` Phil Howard
2023-10-10 10:01       ` Bartosz Golaszewski [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CACMJSeuXd1OSnjmM2Z6MnJOm=rCYJQ1EtYKM5BjrzjhmyFEurg@mail.gmail.com' \
    --to=bartosz.golaszewski@linaro.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=brgl@bgdev.pl \
    --cc=erik.schilling@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=phil@gadgetoid.com \
    --cc=viresh.kumar@linaro.org \
    --cc=warthog618@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).