Bug 22487 - Vergleich auf None
Vergleich auf None
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: ucslint
UCS 2.4
Other Linux
: P5 normal (vote)
: UCS 3.1
Assigned To: Philipp Hahn
Lukas Walter
: interim-2
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-05-11 14:22 CEST by Philipp Hahn
Modified: 2012-12-12 21:09 CET (History)
3 users (show)

See Also:
What kind of report is it?: ---
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Philipp Hahn univentionstaff 2011-05-11 14:22:19 CEST
Vergleiche auf None sollten mit "is None" oder "is not None" passieren, nicht aber per "== None", "!= None" oder "<> None", da dies bei Objekten dazu führt, das dort __eq__() bzw. __cmp__() aufgerufen wird, was ggf. zu Fehlern führt.

re.compile(r"""\b(?:if|while)\b.*(?:(?:!=|<>|==)\s*None\b|\bNone\s*(?:!=|<>|==)).*:""")
Comment 1 Philipp Hahn univentionstaff 2012-07-22 23:34:59 CEST
Umgesetzt in 0009-Python.

svn34344, ucslint_3.0.0-1
Comment 2 Lukas Walter univentionstaff 2012-10-12 15:18:08 CEST
Funktioniert.

============================================================================
S:0009-7: univention-s4-connector/modules/univention/s4connector/__init__.py:1638:6: fragile comparison with None
S:0009-7: univention-s4-connector/modules/univention/s4connector/__init__.py:1654:5: fragile comparison with None
S:0009-7: univention-s4-connector/modules/univention/s4connector/__init__.py:1683:7: fragile comparison with None
S:0009-7: univention-s4-connector/modules/univention/s4connector/s4/password.py:512:4: fragile comparison with None
S:0009-7: univention-s4-connector/modules/univention/s4connector/s4/password.py:526:3: fragile comparison with None
S:0009-7: univention-s4-connector/modules/univention/s4connector/s4/dns.py:709:4: fragile comparison with None
============================================================================

Changelogeintrag fehlt noch -> Reopened.
Comment 3 Philipp Hahn univentionstaff 2012-10-12 17:17:00 CEST
ChangeLog: svn22487
\item \ucsName{ucslint} warns about fragile comparisons with None in Python code (\ucsBug{22487}).
Comment 4 Lukas Walter univentionstaff 2012-10-15 09:47:01 CEST
(In reply to comment #3)
> ChangeLog: svn22487
> \item \ucsName{ucslint} warns about fragile comparisons with None in Python
> code (\ucsBug{22487}).

Verified.
Comment 5 Stefan Gohmann univentionstaff 2012-12-12 21:09:32 CET
UCS 3.1-0 has been released: 
 http://forum.univention.de/viewtopic.php?f=54&t=2125

If this error occurs again, please use "Clone This Bug".