[BUG] Add const feature doesn't work as expect
Closed this issue · 0 comments
There is currently two bugs with the current state of the code, the first one is present at:
Lines 120 to 122 in 31bc912
It's applying the co_consts value in the co_names property incorrectly.
The second bug is here:
Lines 326 to 330 in 31bc912
Whenever there is a code object within the co_consts
attribute, this object gets skipped, but the index does not remain the same, since it is coming from an enumerate function.
This results in a bug in the function that applies the changes that happened to the consts, since the index of the code object that was skipped, will return None
.
Lines 65 to 71 in 31bc912
The "ideal" solution would be having a custom counter, but this would result on yet another bug, if we look closely at the code mentioned above, we can see that it updates the co_consts
based on the list that is saved at the Dear PyGui internals. But if we skip the code while adding and displaying it, the code will never be there, which would cause every code object to be lost from the co_consts
list.
We need to find a way to display the code objects but do not allow the user to modify it on the const
view, and then get this code objects while saving the new co_const
list, since simply calling ast.literal_eval
wouldn't work in this scenario.