From e8c987091fa16ca3753a9700e51a0fe808ede0c4 2024-10-27 17:44:51 From: Guy Bortnikov Date: 2024-10-27 17:44:51 Subject: [PATCH] validate that ESC_PAREN ('/') is followed by a callable name and not empty --- diff --git a/IPython/core/inputtransformer2.py b/IPython/core/inputtransformer2.py index 949cf38..15d3f06 100644 --- a/IPython/core/inputtransformer2.py +++ b/IPython/core/inputtransformer2.py @@ -395,7 +395,10 @@ def _tr_quote2(content): def _tr_paren(content): "Translate lines escaped with a slash: /" - name, _, args = content.partition(' ') + name, _, args = content.partition(" ") + if name == "": + raise SyntaxError(f'"{ESC_SHELL}" must be followed by a callable name') + return '%s(%s)' % (name, ", ".join(args.split())) tr = { ESC_SHELL : 'get_ipython().system({!r})'.format,