#1008 decode_args(): make a copy of the opts dict, rather than modifying it in-place
Merged 5 years ago by mikem. Opened 5 years ago by franzh.
franzh/koji issue1007  into  master

file modified
+2 -2
@@ -440,8 +440,8 @@ 

      if len(args) > 0:

          last = args[-1]

          if isinstance(last, dict) and last.get('__starstar', False):

-             del last['__starstar']

-             opts = last

+             opts = last.copy()

+             del opts['__starstar']

              args = args[:-1]

      return args, opts

  

Fixes: #1007
https://pagure.io/koji/issue/1007

A patch provided by Mike Bonnet. original commit description:

Author: Mike Bonnet mikeb@redhat.com
Date: Wed Jul 18 17:03:56 2018 -0700

The commit changes make_task() to call decode_args() on the arglist before
it is saved to the db. If the method was called with keyword arguments, those
would be passed in a dict at the end of the arglist, with a __starstar entry.
decode_args() edits that dict in place, removing the __starstar entry and
making the arglist appear to end in a single dict argument, effectively
removing the keyword arguments. This change makes a copy of the dict before

Thanks, this is certainly more correct.

Commit e50cd28 fixes this pull-request

Pull-Request has been merged by mikem

5 years ago