Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

4
  • 1
    \$\begingroup\$ Ooh, escaping to another language. I certainly didn't think of that! \$\endgroup\$ Commented May 20, 2022 at 6:24
  • 2
    \$\begingroup\$ You could use __builtins__.__dict__['exec'] instead of os.__dict__['system'], the pop is the interesting part. \$\endgroup\$ Commented May 20, 2022 at 6:27
  • 1
    \$\begingroup\$ But the possibility of using system or popen or etc. makes it much harder to block \$\endgroup\$ Commented May 20, 2022 at 6:32
  • \$\begingroup\$ Ah, this is way simpler than my solution, although I'm proud of it... import pdb; p = pdb.Pdb(skip='*'); p.run('anything'); \$\endgroup\$ Commented Jun 5, 2022 at 17:53