BugList should return a set of int, not string
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Bug Helper |
Invalid
|
Undecided
|
Unassigned | ||
python-launchpad-bugs |
Fix Released
|
Medium
|
Unassigned | ||
python-launchpad-bugs (Ubuntu) |
Fix Released
|
Undecided
|
Markus Korn |
Bug Description
Binary package hint: python-
In the apport crash digger I do some set operations with BugList results, and I just disbelievingly observed that one set grows like this:
set([94694, 103275, 111139]) + set([94694, 103275, 111139]) == set([103275, 111139, 111139, 94694, 103275, 94694])
and so on, yielding an endlessly growing set with duplicates of the original three bug numbers.
This is because BugList returns a set of strings, not a set of ints, and apparently set collapsing uses object identity instead of object equivalence. So, for ints, 1 is 1, but for strings, "1" is not "1".
I worked around this in apport now by converting the set of strings into a set of ints. But this could bite other users, too, so I recommend to return a set of integers right away.
Hello Martin,
thanks for your bug report.
The problem is that each element of these sets are BugInfo-objects not strings or integers. So I'm afraid we can't fix it in the current branch without bigger changes, or do you know a nice solution for this?
I think I can easily fix this in api.changes.gsoc, will commit a patch to this branch soon.
Markus