[Rpm-maint] [rpm-software-management/rpm] Return false when comparing different python objects holding the same version tag (PR #2838)
Beñat Gartzia
notifications at github.com
Thu Jan 11 10:13:22 UTC 2024
Hello!
While I was working on another issue, I found that the inequality operator of python `rpm.ver` objects would not work as I was expecting to. `!=` would always return `True` if the compared objects were not the actual same python object. That was leading to situations as
```python
(v := rpm.ver('1.0')) != v # False, we are comparing the object with itself
rpm.ver('1.0') != rpm.ver('1.0') # True, although they hold the same version tag string
```
I'm not sure whether that was the intended behavior or not. It was not quite what I expected when I tried applying the operator. I didn't research the topic really exhaustively, but I couldn't find related issues at least in the PRs of this repo.
Anyway, this patch adds the `PY_NE` case to the `tp_richcompare` slot function and adds some extra checks to a related existing test.
Thanks for the attention! :smile:
cc: @luckyh
You can view, comment on, or merge this pull request online at:
https://github.com/rpm-software-management/rpm/pull/2838
-- Commit Summary --
* Add rpmver-py inequality operator
-- File Changes --
M python/rpmver-py.c (3)
M tests/rpmpython.at (6)
-- Patch Links --
https://github.com/rpm-software-management/rpm/pull/2838.patch
https://github.com/rpm-software-management/rpm/pull/2838.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2838
You are receiving this because you are subscribed to this thread.
Message ID: <rpm-software-management/rpm/pull/2838 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20240111/337fce72/attachment.html>
More information about the Rpm-maint
mailing list