Message7695
Hi Ralf:
In message <1671647765.44.0.499935488614.issue2551250@roundup.psfhosted.org>,
Ralf Schlatterbeck writes:
>I've recently moved a production tracker from python2 to python3.
>Now I'm getting *occasionally* a Traceback
>
>TypeError: '<' not supported between instances of 'function' and 'function'
>
>when sorting detectors (auditors and reactors).
>These are using a PrioList object which sorts on demand before
>iterating over auditors and/or reactors.
[...]
>The objects in the list are 3-tuples with prio, name, function.
>This should never try to look at the function unless we have two
>entries with the same prio (the default is 100 and this is seldomly
>set explicitly so they may all be the same) and name.
I would expect the prio to be the same but not the name. Could this be
a string vs bytestring issue on the name? Are any of the names in
German?
>Since this is quite urgent for me I'll try to fix this by allowing a
>key function to be passed to the PrioList. This would then be
>something like "lambda x: x[:2]" so that we never compare function
>objects. This is probably the right thing to do.
Agreed. I wonder if this may be an issue in other places we use
Priolist. Can you dump the list it is sorting as well so we have a
clue where the first two elements of the tuple are identical.
This data dump would also serve as a test case for PrioList.
>What I find very confusing is that this should happen everytime when
>sorting the detectors. It doesn't.
To make this happen the name also has to compare the same right? So I
would not expect it to happen. Any idea how the name is ending up the
same? Maybe something is being doubly added under certain
circumstances?
I seem to recall some changes to python internals regarding iteration
orders for dicts, but it shouldn't affect tuples (i.e. the function
gets sorted before the prio/name). |
|
Date |
User |
Action |
Args |
2022-12-21 20:01:46 | rouilj | set | recipients:
+ rouilj, schlatterbeck |
2022-12-21 20:01:46 | rouilj | link | issue2551250 messages |
2022-12-21 20:01:46 | rouilj | create | |
|