Don't assume that SyntaxTB is always called with a SyntaxError

This should fix #4361.