diff --git a/IPython/core/interactiveshell.py b/IPython/core/interactiveshell.py index 42364eb..95c8aab 100644 --- a/IPython/core/interactiveshell.py +++ b/IPython/core/interactiveshell.py @@ -2417,14 +2417,9 @@ class InteractiveShell(SingletonConfigurable): cmd = self.var_expand(cmd, depth=1) # warn if there is an IPython magic alternative. main_cmd = cmd.split()[0] - has_magic_alternatives = ("pip", "conda", "cd", "ls") + has_magic_alternatives = ("pip", "conda", "cd") - # had to check if the command was an alias expanded because of `ls` - is_alias_expanded = self.alias_manager.is_alias(main_cmd) and ( - self.alias_manager.retrieve_alias(main_cmd).strip() == cmd.strip() - ) - - if main_cmd in has_magic_alternatives and not is_alias_expanded: + if main_cmd in has_magic_alternatives: warnings.warn( ( "You executed the system command !{0} which may not work " diff --git a/IPython/core/tests/test_interactiveshell.py b/IPython/core/tests/test_interactiveshell.py index 09dbd96..230a498 100644 --- a/IPython/core/tests/test_interactiveshell.py +++ b/IPython/core/tests/test_interactiveshell.py @@ -623,7 +623,7 @@ class TestSystemRaw(ExitCodeChecks): self.assertEqual(ip.user_ns["_exit_code"], -signal.SIGINT) def test_magic_warnings(self): - for magic_cmd in ("ls", "pip", "conda", "cd"): + for magic_cmd in ("pip", "conda", "cd"): with self.assertWarnsRegex(Warning, "You executed the system command"): ip.system_raw(magic_cmd)