Subject: bug#40692: 28.0.50; Constant list modified inside function

From: Ivan Andrus <[email-masked]>
Date: Fri, 17 Apr 2020 21:05:31 -0600

On Apr 17, 2020, at 5:45 PM, Ivan Andrus <[email-masked]> wrote:
> 
> I believe this is the root cause of a bug in magit/forge https://github.com/magit/forge/issues/267 in which all subsequent pull requests created have the same name.  The maintainer of magit/forge (tarsius) was unable to reproduce that bug, so I tried my hand at creating a minimal test case, and I was able to get it down to this.
> 
> Now, I understand reference semantics of lists in general, but it seems like this should be different.  If this behavior is intentional, what's the best way to for creation of a new list every time so that functions using the alist don't have to worry about not changing the list?

I tracked down the function doing the actual changing: json-encode-alist.  I filed https://debbugs.gnu.org/cgi/bugreport.cgi?bug=40693   

I still find the behavior here confusing, but I expect it will be considered expected behavior.

-Ivan