diff --git a/src/pylib/builtins/dict.nim b/src/pylib/builtins/dict.nim index 42a1f7a3e..a90b957ee 100644 --- a/src/pylib/builtins/dict.nim +++ b/src/pylib/builtins/dict.nim @@ -110,7 +110,7 @@ func toPyDict*[K, V](x: openArray[(K, V)]): PyDict[K, V] = func toPyDict*[K, V](x: not openArray[(K, V)] and Iterable[(K, V)]): PyDict[K, V] = result = newPyDictImpl[K, V]() - for k, v in x: + for (k, v) in x: result[k] = v func copy*[K, V](self: PyDict[K, V]): PyDict[K, V] = diff --git a/src/pylib/builtins/dict_decl.nim b/src/pylib/builtins/dict_decl.nim index c5016a9b3..f91e47f9e 100644 --- a/src/pylib/builtins/dict_decl.nim +++ b/src/pylib/builtins/dict_decl.nim @@ -12,7 +12,7 @@ template newPyDictImpl*[K, V](x: int): untyped = bind initOrderedTable PyDict[K, V](data: initOrderedTable[K, V](x)) -template newPyDictImpl*[K, V](x: varargs): untyped = +template newPyDictImpl*[K, V](x: openArray[(K, V)] = []): untyped = ## zero or one arg ## shall support `[]`, `{k:v, ...}`, `@[(k, v),...]` bind toOrderedTable