ID 608674 - A crash occurs when setting keyframes on a Roto node via Python

Follow

Problem summary
A crash occurs when setting keyframes on a Roto node via Python. 
However, this only happens in particular scripts/with specific node setups, such as when a FrameRange and Switch node are downstream from the Roto node.
 
Customer reported version
N/A
 
Customer reported platform
N/A
 
Steps to reproduce
 
1) Open Nuke.
 
2) Create a Roto node and create a shape in the Viewer.
 
3) Create a FrameRange node, downstream of the Roto.
 
4) Create a Switch node, connecting input 0 to the FrameRange node and input 1 to the Roto node.
 
5) Double click the Roto node, to ensure that its shape is visible in the Viewer.
 
6) Execute the following code in the Script Editor:

my_node = nuke.toNode("Roto1") k = my_node.knob("opacity") ## also happens with other knobs, such as "feather"k.setAnimated() a =  k.animations() for cr in a:     cr.setKey(nuke.frame(), 1)     cr.setKey(nuke.frame()-1, 0)     cr.setKey(nuke.frame()+1, 0)
 
The same issue happens when setting keyframes on the knob object itself: 
my_node = nuke.toNode("Roto1") k = my_node.knob("opacity") k.setAnimated() a =  k.animations() k.setValue(nuke.frame(), 1) k.setValue(nuke.frame()+1, 0) k.setValue(nuke.frame()-1, 0)
 
Expected behaviour
Nuke should not crash.
 
Actual behaviour
Nuke crashes when executing the Python code with this particular .nk script/node setup.
 
Workaround
Unknown.
 
Reproduced by support
This bug has been reproduced in:
Nuke 16.0v6 - Windows 11 - Rocky 9
Nuke 13.2v9 - Windows 11 - CentOS 7
 
Earliest version tested
Nuke 13.2v9 
- This issue appears to be in all tested versions of the product

    We're sorry to hear that

    Please tell us why