bindings: python: allow releasing LineRequest multiple times
PATCH 1/1 bindings: python: allow releasing LineRequest multiple times
Allow releasing a LineRequest mulitple times without throwing a RequestReleasedError to adhere to common Python semantics.
Signed-off-by Vincent Fazio <[email protected]>
--- bindings/python/gpiod/line_request.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
bindings/python/gpiod/line_request.py +3 -3
@@ -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: """
Signature · 1 line
2.43.0
Bartosz Golaszewski
maintainerQuoted 4 lines · Vincent Fazio
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