Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
S slapos.toolbox
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge requests 1
    • Merge requests 1
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • nexedi
  • slapos.toolbox
  • Merge requests
  • !122

Merged
Created Oct 27, 2023 by Kirill Smelkov@kirrOwner

*: Compare strings by == or != instead of by `is` or `is not`

  • Overview 7
  • Commits 2
  • Changes 6

In python is checks object identity, not content:

In [1]: a = 'hello'

In [2]: a += ' world'

In [3]: b = 'hello world'

In [4]: id(a)
Out[4]: 139735676540976

In [5]: id(b)
Out[5]: 139735675829040

In [6]: a is b              <-- NOTE
Out[6]: False

In [7]: a == b              <-- NOTE
Out[7]: True

So comparing strings by is is generally incorrect.

-> Fix strings comparision to use == / != everywhere (at least in found places where string is compared wrt string literal)

We already had similar fix in a8526f4e, but seems the story continues again.

/cc @alain.takoudjou, @Just1, @lu.xu, @jhuge, @tomo

Assignee
Assign to
Reviewer
Request review from
None
Milestone
None
Assign milestone
Time tracking
Source branch: y/str-eq
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7