You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[CLIENT-4120] Fix filter expressions being ignored when passed to batch write, batch read, batch remove, and batch apply policies (#933)
[CLIENT-4121] Remove as_exp *exp_list parameter from pyobject_to_policy_*() helpers
Several reasons why pyobject_to_policy_*()'s exp_list parameter is redundant:
- pyobject_to_policy_*() only uses exp_list by passing a reference to it to as_exp_new_from_pyobject(), and assigns its new value to policy->filter_exp. (basically the same as using a local pointer variable) The same can be done by passing exp_list_p directly to as_exp_new_from_pyobject and dereferencing it to set policy->filter_exp. This also sets the pointer at exp_list_p as intended.
- The methods calling pyobject_to_policy_*() either 1) pass in a pointer to a stack allocated as_exp object, or 2) pass in NULL, as an argument to exp_list. The calling method does not use the stack allocated as_exp object since pyobject_to_policy_*() already heap allocates an as_exp object and sets exp_list_p to point to it. And the caller already uses exp_list_p to clear the heap allocated as_exp object. Hence there's no reason to pass a reference to the stack as_exp object in the caller's frame. Case 2 causes the bug in CLIENT-4120 because pyobject_to_policy_*() will ignore the Python expressions if exp_list is NULL.
New tests are targeting changes to batch_write.c
0 commit comments