mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Fix dict compare for cmp function.
When passed 2 dicts, the cmp function would fail with a TypeError of "'>' not supported between instances of 'dict' and 'dict'\n". This change adds a check for dict types and compares them with ==.
This commit is contained in:
parent
ad5a80da42
commit
494c6391f6
1 changed files with 2 additions and 0 deletions
|
@ -61,6 +61,8 @@ def cmp(x, y):
|
|||
|
||||
Return negative if x<y, zero if x==y, positive if x>y.
|
||||
"""
|
||||
if isinstance(x, dict) and isinstance(y, dict):
|
||||
return 0 if x == y else -1
|
||||
return (x > y) - (x < y)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue