* [libgpiod][PATCH] bindings: python: allow releasing LineRequest multiple times
@ 2026-04-02 23:03 Vincent Fazio
2026-04-03 9:06 ` Bartosz Golaszewski
0 siblings, 1 reply; 2+ messages in thread
From: Vincent Fazio @ 2026-04-02 23:03 UTC (permalink / raw)
To: linux-gpio; +Cc: Vincent Fazio
Allow releasing a LineRequest mulitple times without throwing a
RequestReleasedError to adhere to common Python semantics.
Signed-off-by: Vincent Fazio <vfazio@gmail.com>
---
bindings/python/gpiod/line_request.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/bindings/python/gpiod/line_request.py b/bindings/python/gpiod/line_request.py
index 0287791..a271080 100644
--- a/bindings/python/gpiod/line_request.py
+++ b/bindings/python/gpiod/line_request.py
@@ -75,9 +75,9 @@ class LineRequest:
Release this request and free all associated resources. The object must
not be used after a call to this method.
"""
- self._check_released()
- cast("_ext.Request", self._req).release()
- self._req = None
+ if self._req is not None:
+ self._req.release()
+ self._req = None
def get_value(self, line: int | str) -> Value:
"""
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [libgpiod][PATCH] bindings: python: allow releasing LineRequest multiple times
2026-04-02 23:03 [libgpiod][PATCH] bindings: python: allow releasing LineRequest multiple times Vincent Fazio
@ 2026-04-03 9:06 ` Bartosz Golaszewski
0 siblings, 0 replies; 2+ messages in thread
From: Bartosz Golaszewski @ 2026-04-03 9:06 UTC (permalink / raw)
To: Vincent Fazio; +Cc: linux-gpio
On Fri, Apr 3, 2026 at 1:03 AM Vincent Fazio <vfazio@gmail.com> wrote:
>
> Allow releasing a LineRequest mulitple times without throwing a
> RequestReleasedError to adhere to common Python semantics.
>
Same comment as for chips. A comment in the code would do too.
Bart
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-04-03 9:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-02 23:03 [libgpiod][PATCH] bindings: python: allow releasing LineRequest multiple times Vincent Fazio
2026-04-03 9:06 ` Bartosz Golaszewski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox