Fix crashes related to sparse and CData

Still need to fix CData on python 3. do not merge yet.

See [theano-users] Error computing gradient of sparse sum (sp_sum)
have an -> has an