Add dynamic_prop::is_constant
I noticed many spots checking whether a dynamic property's kind is PROP_CONST. Some spots, I think, are doing a slightly incorrect check -- checking for != PROP_UNDEFINED where == PROP_CONST is actually required, the key thing being that const_val may only be called for PROP_CONST properties. This patch adds dynamic::is_constant and then updates these checks to use it. Regression tested on x86-64 Fedora 36.
This commit is contained in:
parent
14e8fded85
commit
9c0fb73485
14 changed files with 45 additions and 43 deletions
|
@ -609,12 +609,12 @@ typy_range (PyObject *self, PyObject *args)
|
|||
case TYPE_CODE_ARRAY:
|
||||
case TYPE_CODE_STRING:
|
||||
case TYPE_CODE_RANGE:
|
||||
if (type->bounds ()->low.kind () == PROP_CONST)
|
||||
if (type->bounds ()->low.is_constant ())
|
||||
low = type->bounds ()->low.const_val ();
|
||||
else
|
||||
low = 0;
|
||||
|
||||
if (type->bounds ()->high.kind () == PROP_CONST)
|
||||
if (type->bounds ()->high.is_constant ())
|
||||
high = type->bounds ()->high.const_val ();
|
||||
else
|
||||
high = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue