get rid of dangerous "TypeError = not constant" mechanism

This is a rebase of https://github.com/Theano/Theano/pull/1071