Skip to content

BUG: arbitrary dict comparison causes issues #598

Closed

Description

@jkowalleck

dict comparison causes issues.

this is new in v7.3.1, did not happen with v7.3.0

  

  File "/.../.venv/lib/python3.11/site-packages/sortedcontainers/sortedset.py", line 359, in add
    self._list.add(value)
  File "/.../.venv/lib/python3.11/site-packages/sortedcontainers/sortedlist.py", line 279, in add
    insort(_lists[pos], value)
  File "/.../.venv/lib/python3.11/site-packages/cyclonedx/model/component.py", line 1701, in __lt__
    return _ComparableTuple((
           ^^^^^^^^^^^^^^^^^^
  File "/.../.venv/lib/python3.11/site-packages/cyclonedx/_internal/compare.py", line 41, in __lt__
    return True if s < o else False
                   ^^^^^
TypeError: '<' not supported between instances of 'dict' and 'dict'
CRITICAL | CDX > '<' not supported between instances of 'dict' and 'dict'

v7.3.1 introduced a feature, and hide it as a bug fix ...
anyway, the v7.3.1 SHOULD be yanked, and a fixed version must be released.

Activity

  1. jkowalleck commented on Apr 25, 2024

    @jkowalleck
    MemberAuthor
    o = PackageURL(type='pypi', namespace=None, name='pathlib2', version='2.3.5', qualifiers={}, subpath=None)
    s = PackageURL(type='pypi', namespace=None, name='pathlib2', version='2.3.5', qualifiers={'vcs_url': 'git+https://github.com/jazzband/pathlib2.git@5a6a88db3cc1d08dbc86fbe15edfb69fb5f5a3d6'}, subpath=None)
    

    the qualifiers dict seams to be the issue ...

  2. jkowalleck commented on Apr 25, 2024

    @jkowalleck
    MemberAuthor

    background: PackageURL shows itself as named tuple.
    tupe comparrison is fine.

    BUT one o the tuples values is a dict: qualifiers. and when the tuple comes to compare its elements, it will have issues comparing the qualifiers - and raise an error.

  3. self-assigned this
    on Apr 25, 2024
  4. jkowalleck commented on Apr 25, 2024

    @jkowalleck
    MemberAuthor

    @madpah FYI.

    I will fix this and yank the broken version afterwards

  5. changed the title [-]BUG: arbitrary dict comparrsson causes issues[/-] [+]BUG: arbitrary dict comparison causes issues[/+] on Apr 25, 2024
  6. added a commit that references this issue on Apr 26, 2024
    8df488c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions