Skip to content

String comparison using '==' instead of 'is'

Caught this common issue while running a test environment

gracedb/search/utils.py:28: SyntaxWarning: "is" with a literal. Did you mean "=="?
  indices = [i for i, x in enumerate(toks) if x is '|']

This should be an equal-by-value rather than equal-by-identity check, and only evaluates to True due to an accident of Python's caching. This could easily change, either in future Python versions, or through some subtleties of GraceDB's startup process.

Merge request reports