Commit b65cf89
authored
validate ESC_PAREN ('/') is followed by a callable name and not empty (ipython#12690)
When running a single python expression with just a slash - `/`, a tuple
is returned.
```python
In [1]: /
Out[1]: ()
```
This weird case happens because when a line starts with `/` the
`inputtransformer` transforms it into a call of the first word after the
`/` as the callable name and rest tokens after as arguments.
This PR fixes that issue by validating that at least a callable name is
given and it's not empty, if not a `SyntaxError` will be raised.
```python
In [1]: /
File "<ipython-input-1-8f27084b6294>", line 1
/
^
SyntaxError: invalid syntax
In [2]:
```
Validated that tests are passing.1 file changed
+4
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
395 | 395 | | |
396 | 396 | | |
397 | 397 | | |
398 | | - | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
399 | 402 | | |
400 | 403 | | |
401 | 404 | | |
| |||
0 commit comments