Problems with multiple layer naming in one command

After running this script

import rhinoscriptsyntax as rs
from scriptcontext import doc

def main():
  layer = doc.Layers[0]
 
  layer.Name = "One"
  layer.CommitChanges()
 
  layer.Name = "Two"
  layer.CommitChanges() 


if __name__ == "__main__":
  main()    

if undoing it, the layer name will be “One” rather then the initial name. Am I doing something wrong?

Thanks a lot
Alberto

This is a bug, @Alberto.
Thanks for reporting this. We will investigate this soon.

https://mcneel.myjetbrains.com/youtrack/issue/RH-36423

Glad to help! Have fun debugging this :wink: