diff options
author | Victor Stinner <vstinner@python.org> | 2022-10-03 17:09:02 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-03 17:09:02 +0200 |
commit | 64fe34371722d90448e0d1a0c04e7ed106f5f70a (patch) | |
tree | 3469166def39cfc26dfdce75062fddd5ab0d1d98 /Tools/demo/rpythond.py | |
parent | e6f9ec5c031bd996fcd5f463c407beef0b743b49 (diff) | |
download | cpython-64fe34371722d90448e0d1a0c04e7ed106f5f70a.tar.gz cpython-64fe34371722d90448e0d1a0c04e7ed106f5f70a.zip |
gh-97681: Remove Tools/demo/ directory (#97682)
Remove the Tools/demo/ directory which contained old demo scripts. A
copy can be found in the old-demos project:
https://github.com/gvanrossum/old-demos
Remove the following old demo scripts:
* beer.py
* eiffel.py
* hanoi.py
* life.py
* markov.py
* mcast.py
* queens.py
* redemo.py
* rpython.py
* rpythond.py
* sortvisu.py
* spreadsheet.py
* vector.py
Changes:
* Remove a reference to the redemo.py script in the regex howto
documentation.
* Remove a reference to the removed Tools/demo/ directory in the
curses documentation.
* Update PC/layout/ to remove the reference to Tools/demo/ directory.
Diffstat (limited to 'Tools/demo/rpythond.py')
-rwxr-xr-x | Tools/demo/rpythond.py | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/Tools/demo/rpythond.py b/Tools/demo/rpythond.py deleted file mode 100755 index 4e47fb9ec41..00000000000 --- a/Tools/demo/rpythond.py +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env python3 - -""" -Remote python server. -Execute Python commands remotely and send output back. - -WARNING: This version has a gaping security hole -- it accepts requests -from any host on the internet! -""" - -import sys -from socket import socket, AF_INET, SOCK_STREAM -import io -import traceback - -PORT = 4127 -BUFSIZE = 1024 - -def main(): - if len(sys.argv) > 1: - port = int(sys.argv[1]) - else: - port = PORT - s = socket(AF_INET, SOCK_STREAM) - s.bind(('', port)) - s.listen(1) - while True: - conn, (remotehost, remoteport) = s.accept() - with conn: - print('connection from', remotehost, remoteport) - request = b'' - while True: - data = conn.recv(BUFSIZE) - if not data: - break - request += data - reply = execute(request.decode()) - conn.send(reply.encode()) - -def execute(request): - stdout = sys.stdout - stderr = sys.stderr - sys.stdout = sys.stderr = fakefile = io.StringIO() - try: - try: - exec(request, {}, {}) - except: - print() - traceback.print_exc(100) - finally: - sys.stderr = stderr - sys.stdout = stdout - return fakefile.getvalue() - -try: - main() -except KeyboardInterrupt: - pass |