[Maya Python API] lodGroup node creation slow/deferred?

Here is something interesting. If you try to parent an existing object (on user select for example) to a newly created transform node by running the code below all at once, everything works fine.

import maya.OpenMaya as api

DGMod = api.MDagModifier()
nO = DGMod.createNode('transform')
nFn = api.MFnDagNode(nO)
nFn.setName('TAO')
DGMod.doIt()
# ---------------------------------------------
selection = api.MSelectionList()
api.MGlobal.getActiveSelectionList(selection)
selectionObjList = api.MObjectArray()
for i in range(selection.length()):
    mObj = api.MObject()
    selection.getDependNode(i, mObj)
    selectionObjList.append(mObj)
# ---------------------------------------------
for i in range(selectionObjList.length()):
    DGMod.reparentNode(selectionObjList[i], nO)
DGMod.doIt()

Now replace node type to ‘lodGroup’ and run entire code again - it will actually crash Maya.
Now try to run it a code block at a time - works fine…

Edit: Confirmed on versions 2011 - 2014
Edit: Confirmed on both sets of api (maya.OpenMaya & maya.api.OpenMaya)

Any thoughts?
Cheers!

I’ve tried other ways of creating a node like via MFnDagNode.create() method or even wrapping the creation into a method which calls ‘createNode’ MEL command through MGlobal.executeCommand().
Also tried putting in an artificial pause between creation and parenting via time.sleep() method.
Nothing works. Maya crashes every time.

Hmm… Attaching to process yielded unhandled exception due to null pointer reference in ModelSlice.dll

Unhandled exception at 0x000007fce4593d3c in maya.exe: 0xC0000005: Access violation reading location 0x0000000000000000.

Are dag modifier calls processed asynchronously?

Figured it out… Calling M3dView.refresh() after node creation seems to fix it.