Skip to content

Commit 9e264b8

Browse files
d-w-moorealanking
authored andcommitted
[#17] fix Query.copy: in python3, dict.items() no longer produces a list
As such, f( **(d1.items()+d2.items()) ) is no longer a valid construct in Python3, and we must express it instead as f(**{**d1,**d2}). The meaning is of course the same, and that is: in calling f, apply the keywords in d1 but overridden with the values in d2 wherever there is overlap.
1 parent 3213c1d commit 9e264b8

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

genquery.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,8 @@ def copy(self,**options):
156156
incorrect = list(k for k in options if k not in self.__parameter_names)
157157
if incorrect:
158158
raise GenQuery_Options_Spec_Error('Incorrect option(s) to Query: '+', '.join(incorrect))
159-
return Query(self.callback, **(dict(self.parameters.items() + options.items())))
159+
# let `options' override but not duplicate `self.parameters' in the keyword argument list
160+
return Query(self.callback, **{**self.parameters, **options})
160161

161162
def exec_if_not_yet_execed(self):
162163
"""Query execution is delayed until the first result or total row count is requested."""

0 commit comments

Comments
 (0)