Small issue with using numpy arrays as textures

After a bit of flailing, I’ve managed to pipeline numpy arrays into Panda3d textures. It works, but I get an assertion error that’s slowing me down. What am I doing wrong?

self.arr = numpy.zeros((64, 64, 3), dtype=numpy.uint8)
self.imageTexture = Texture("image")
self.imageTexture.setup2dTexture(64, 64, Texture.TUnsignedByte, Texture.FRgb)

p = PTAUchar()
p.clear()
try:
    p.setData(self.arr)
except AssertionError:
    pass
self.imageTexture.setRamImage(CPTAUchar(p))

yields:

Assertion failed: (this->_void_ptr) != NULL at line 570 of built/include/pointerToArray.I

It works inasmuch as the texture data surely winds up usable in Panda3d. But the stack unwinding on account of the AssertionErro per-frame I think is slowing my framerate.

Instead of:

p = PTAUchar()
p.clear() 

Use:

p = PTAUchar.emptyArray(0)

David