For further context, the enum in question is defined in Rust and
exported to Python via PyO3[1]. These enums are similar to, but not
interoperable with, Python’s IntEnum[2], and the relevant PyO3
documentation[3] suggests by example that == is the expected comparison
operator.
[1]
https://github.com/pyca/cryptography/blob/ad7990293c129202eefc7147e528db805e100440/src/rust/src/exceptions.rs#L13
[2] https://docs.python.org/3/library/enum.html#enum.IntEnum,
[3] https://pyo3.rs/main/class#simple-enums
On 7/22/24 3:46 AM, Barry wrote:
On 22 Jul 2024, at 08:14, Miro Hrončok <mhroncok@xxxxxxxxxx> wrote:
They have the same repr, type, int value. They have different IDs.
I think that shows the “is” use is a bug and the fix is to use ==.
Barry
--
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue