@@ -4235,7 +4235,11 @@ module StdlibPrivate {
42354235 // ---------------------------------------------------------------------------
42364236 // Flow summaries for functions contructing containers
42374237 // ---------------------------------------------------------------------------
4238- /** A flow summary for `dict`. */
4238+ /**
4239+ * A flow summary for `dict`.
4240+ *
4241+ * see https://docs.python.org/3/library/stdtypes.html#dict
4242+ */
42394243 class DictSummary extends SummarizedCallable {
42404244 DictSummary ( ) { this = "builtins.dict" }
42414245
@@ -4246,18 +4250,23 @@ module StdlibPrivate {
42464250 }
42474251
42484252 override predicate propagatesFlow ( string input , string output , boolean preservesValue ) {
4253+ // The positional argument contains a mapping.
4254+ // TODO: Add the list-of-pairs version
4255+ // TODO: these values can be overwritten by keyword arguments
42494256 exists ( DataFlow:: DictionaryElementContent dc , string key | key = dc .getKey ( ) |
42504257 input = "Argument[0].DictionaryElement[" + key + "]" and
42514258 output = "ReturnValue.DictionaryElement[" + key + "]" and
42524259 preservesValue = true
42534260 )
42544261 or
4262+ // The keyword arguments are added to the dictionary.
42554263 exists ( DataFlow:: DictionaryElementContent dc , string key | key = dc .getKey ( ) |
42564264 input = "Argument[" + key + ":]" and
42574265 output = "ReturnValue.DictionaryElement[" + key + "]" and
42584266 preservesValue = true
42594267 )
42604268 or
4269+ // Imprecise content in any argument ends up on the container itself.
42614270 input = "Argument[0]" and
42624271 output = "ReturnValue" and
42634272 preservesValue = false
0 commit comments