Attention is currently required from: fixeria, laforge.

neels has posted comments on this change by neels. ( 
https://gerrit.osmocom.org/c/pysim/+/42260?usp=email )

Change subject: ConfigurableParameter: safer val length check
......................................................................


Patch Set 4:

(1 comment)

Commit Message:

https://gerrit.osmocom.org/c/pysim/+/42260/comment/c0effa1e_1a8846b8?usp=email :
PS1, Line 7: Co
> needs --verbose commit log, I'm not understanding why the new code is safer.
We call len(), which is implemented via a `__len__()` attribute.
If you run len() on something without a `__len__()`, then the program crashes 
-- but we just want to do treat non-lists like an empty list (IIRC)

In python there is no plain way to determine whether a class is a list type, 
the easiest is to make sure a `__len__` function is present before calling 
len(). If there is no `__len__` then set a local variable to 0. using that is 
safe.



--
To view, visit https://gerrit.osmocom.org/c/pysim/+/42260?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Ibe91722ed1477b00d20ef5e4e7abd9068ff2f3e4
Gerrit-Change-Number: 42260
Gerrit-PatchSet: 4
Gerrit-Owner: neels <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: laforge <[email protected]>
Gerrit-Attention: laforge <[email protected]>
Gerrit-Attention: fixeria <[email protected]>
Gerrit-Comment-Date: Fri, 24 Apr 2026 22:26:28 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: laforge <[email protected]>

Reply via email to