System Information
Windows 8.1, 64bit
Blender Version
Broken: 2.75a official
Short description of error
Exact steps for others to reproduce the error
Add a Plane, go to edit mode and run below script several times. It should eventually produce an error that bytes object does not have property "index" or "co". Subsequent runs of the script or clicks in viewport may crash Blender.
import bpy
import bmesh
import random
ob = bpy.context.object
assert ob.type == "MESH"
me = ob.data
bm = bmesh.from_edit_mesh(me)
new_order = list(range(len(bm.verts)))
random.shuffle(new_order)
for i, v in zip(new_order, bm.verts):
v.index = i
print("shuffled indices:")
for v in bm.verts:
print(v.index)
print("update index()")
bm.verts.index_update()
print("indices returned to original order:")
for v in bm.verts:
print(v.index, v.co.xy)
print("shuffling again, followed by a sort:")
for i, v in zip(new_order, bm.verts):
v.index = i
bm.verts.sort()
for v in bm.verts:
print(v.index, v.co.xy)
bmesh.update_edit_mesh(me)