I am attempting to create a new label class for a layer using the arcpy CIM, code below. The new label class gets created, but ArcGIS Pro immediately crashes when I attempt to interact with it in the GUI. I have tried in the python window and in a script.
aprx = arcpy.mp.ArcGISProject('CURRENT')
m = aprx.listMaps("Map")[0]
lyr = m.listLayers("SOME LAYER")[0]
ldef = lyr.getDefinition('V2')
newlblclass = arcpy.cim.CreateCIMObjectFromClassName('CIMLabelClass','V2')
newlblclass.name = "NEW CLASS"
newlblclass.visibility = True
ldef.labelClasses.append(newlblclass)
lyr.setDefinition(ldef)