Serhiy Storchaka added the comment: This will break any code that pass str(path) to API that doesn't support pathlib.
In your case you can introduce a short alias: q = shlex.quote ssh_client.run(f'/bin/rm {q(str(path))}') Or add more convenient helper: def q(path): return shlex.quote(str(path)) ssh_client.run(f'/bin/rm {q(path)}') ---------- nosy: +serhiy.storchaka resolution: -> rejected stage: -> resolved status: open -> closed _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28811> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com