Added region check to tuple object#46
Conversation
As far as I can see in the source code, tuples are always created in the local region (effectively), and get their arguments before they are assigned anywhere. So the only check added to set_item should always succeed. Leaving optimising this case for future work.
|
Just read Which might suggest we can't always optimise. Also not sure what we should do if a C module calls the macro PyTuple_SETITEM |
|
Thanks for finding that. So let's keep this as is! |
|
The changes look good to me.
I'd say it depends on the module the macro is defined in. Since this one appears to be public (No On the other hand, macro/function doesn't do a bounds check and just allows indexing anywhere. We could mark the region as "dirty" when an item is set via this function. But this might be too strict in some cased. So I'd suggest adding a |
|
@mjp41 Can I merge this? |
|
Merging after discussion with @mjp41 |
As far as I can see in the source code, tuples are always created in the local region (effectively), and get their arguments before they are assigned anywhere. So the only check added to set_item should always succeed. Leaving optimising this case for future work.