* [PATCH] dts: ConfigurationError not thrown due to lack of next default value
@ 2026-04-14 15:21 Riley Fletcher
2026-04-16 10:50 ` Luca Vizzarro
0 siblings, 1 reply; 2+ messages in thread
From: Riley Fletcher @ 2026-04-14 15:21 UTC (permalink / raw)
To: luca.vizzarro, probb; +Cc: dev, Riley Fletcher
In DTS, when providing an nonexisting PCI address, a ConfigurationError
should be thrown. Instead, because the next() is not given a default
None, it instead hits a StopIteration error, which is harder to debug.
Signed-off-by: Riley Fletcher <rileyf@linux.ibm.com>
---
dts/framework/testbed_model/linux_session.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dts/framework/testbed_model/linux_session.py b/dts/framework/testbed_model/linux_session.py
index ee943462c2..3de92b549e 100644
--- a/dts/framework/testbed_model/linux_session.py
+++ b/dts/framework/testbed_model/linux_session.py
@@ -168,7 +168,7 @@ def get_port_info(self, pci_address: str) -> PortInfo:
ConfigurationError: If the port could not be found.
"""
bus_info = f"pci@{pci_address}"
- port = next(port for port in self._lshw_net_info if port.get("businfo") == bus_info)
+ port = next((port for port in self._lshw_net_info if port.get("businfo") == bus_info), None)
if port is None:
raise ConfigurationError(f"Port {pci_address} could not be found on the node.")
--
2.53.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] dts: ConfigurationError not thrown due to lack of next default value
2026-04-14 15:21 [PATCH] dts: ConfigurationError not thrown due to lack of next default value Riley Fletcher
@ 2026-04-16 10:50 ` Luca Vizzarro
0 siblings, 0 replies; 2+ messages in thread
From: Luca Vizzarro @ 2026-04-16 10:50 UTC (permalink / raw)
To: Riley Fletcher; +Cc: dev, patrickrobb1997
Hi Riley,
Thank you for this fix! Looks good to me, this is obviously a bug. It
needs the Fixes tag referencing the original commit, so that it can be
retrospectively fixed on the LTS versions. The CI would complain about
this if the commit subject would be correctly phrased to something like:
dts: fix port info getter when port is not found
Luca
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-04-16 10:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-14 15:21 [PATCH] dts: ConfigurationError not thrown due to lack of next default value Riley Fletcher
2026-04-16 10:50 ` Luca Vizzarro
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox