|SUCCESS| dts: fix topology capability comparison
dpdklab at iol.unh.edu
dpdklab at iol.unh.edu
Mon May 11 01:22:33 CEST 2026
Test-Label: ai-code-review
Test-Status: SUCCESS
https://dpdk.org/patch/163878
_AI Code Review_
=== Patch Review: series.patch (via Claude) ===
Review date: 2026-05-10
Commit: [git sha not provided in patch]
Author: Thomas Monjalon <thomas at monjalon.net>
Subject: dts: fix topology capability comparison
This patch fixes infinite recursion and incorrect comparison behavior in
the TopologyCapability comparison operators __gt__() and __le__().
> diff --git a/dts/framework/testbed_model/capability.py b/dts/framework/testbed_model/capability.py
> index 960370fc72..96e1cd449f 100644
> --- a/dts/framework/testbed_model/capability.py
> +++ b/dts/framework/testbed_model/capability.py
> @@ -574,7 +574,9 @@ def __gt__(self, other: Any) -> bool:
> Returns:
> :data:`True` if the instance's topology type is more complex than the compared object's.
> """
> - return other < self
> + if not self.is_comparable_with(other):
> + return False
> + return self.topology_type > other.topology_type
The fix for __gt__() looks correct. Does is_comparable_with() verify that
other is a TopologyCapability instance? If not, could other.topology_type
raise AttributeError?
>
> def __le__(self, other: Any) -> bool:
> """Compare the :attr:`~TopologyCapability.topology_type`s.
> @@ -586,7 +588,9 @@ def __le__(self, other: Any) -> bool:
> :data:`True` if the instance's topology type is less complex or equal than
> the compared object's.
> """
> - return not self > other
> + if not self.is_comparable_with(other):
> + return False
> + return self.topology_type <= other.topology_type
Similar question here regarding type safety - can topology_type be safely
accessed after is_comparable_with() returns True?
The logic appears sound, but without seeing the is_comparable_with()
implementation, there may be a potential AttributeError if other does not
have a topology_type attribute. Can you confirm is_comparable_with()
performs instance type checking?
More information about the test-report
mailing list