Don't reuse SyntaxError in masking.py
This exception type is really intended for errors in *Python* syntax. In
particular, IPython will add extra lines to the stack-trace to try to show
the original line of Python where the error came from.
Compare:
In [2]: raise ValueError
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-2-e4c8e09828d5> in <module>
----> 1 raise ValueError
ValueError:
In [3]: raise SyntaxError
Traceback (most recent call last):
File "/Users/shoyer/miniconda3/envs/jax-py37/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 3326, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-3-52c234f9b487>", line 1, in <module>
raise SyntaxError
File "<string>", line unknown
SyntaxError
So I think it's better just to define our own `ShapeSyntaxError`.