This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: QVariant NULL returns anomalous values in equality statements
Type: behavior Stage: resolved
Components: Interpreter Core Versions: Python 3.6
process
Status: closed Resolution: third party
Dependencies: Superseder:
Assigned To: Nosy List: John Midgett, iritkatriel
Priority: normal Keywords:

Created on 2019-09-12 19:25 by John Midgett, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (2)
msg352227 - (view) Author: John Midgett (John Midgett) Date: 2019-09-12 19:25
Per PEP 8, equality comparisons to None should use the "is" or "is not" keywords. However, if x is a {QVariant}NULL, the equality statement with the "is" keyword returns FALSE whereas the "==" comparison returns TRUE.  

Hence where cond = {QVariant}NULL:

    if cond is None  # Returns False
    if cond == None  # Returns True

This can cause some unexpected code anomalies (as it did for me) when adjusting code for PEP 8 compliance.
msg396001 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2021-06-17 13:09
This looks like an issue with the way QVariant is defined. I'm not sure why you are reporting it as a Python bug?
History
Date User Action Args
2022-04-11 14:59:20adminsetgithub: 82327
2021-06-25 22:28:25iritkatrielsetstatus: pending -> closed
stage: resolved
2021-06-17 13:09:49iritkatrielsetstatus: open -> pending

nosy: + iritkatriel
messages: + msg396001

resolution: third party
2019-09-12 19:25:44John Midgettcreate