mirror of
https://github.com/github/codeql.git
synced 2026-07-12 23:15:40 +02:00
Extends our modelling to partially cover the behaviour of `copy.replace`. In particular, we model this in two ways: Firstly, we extend the existing Models-as-Data row for `copy` and `deepcopy` to also cover `replace`. This means that we treat the result of `replace` as containing all of the fields of the original object. This is somewhat _more_ than we want, as strictly speaking the fields that are overwritten should _not_ propagate flow through the `replace` call, but currently we don't have a good way of modelling this blocking of flow. Secondly, we add a flow summary that adds flow from named arguments of the `replace` call to the corresponding fields on the base object. This ensures that we at least have the new flow arising from the `replace` call. Note that the flow summary adds this flow for _all_ named arguments of _all_ `replace` calls throughout the codebase. However, since any particular `replace` call will only populate a subset of these (the subset consisting of exactly those named arguments that are in that particular call), this does not cause any unwanted crosstalk between different `replace` calls.§