summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/rpc.py
diff options
context:
space:
mode:
authorKurt B. Kaiser <kbk@shore.net>2002-06-26 02:32:09 (GMT)
committerKurt B. Kaiser <kbk@shore.net>2002-06-26 02:32:09 (GMT)
commitffd3a4217a557bad4984621c22f5ae312d708169 (patch)
treef11990897d270f026c473a7e740a4a3e7968b665 /Lib/idlelib/rpc.py
parentfdc34315f7860f6b47cead676e0b6dda987d1008 (diff)
downloadcpython-ffd3a4217a557bad4984621c22f5ae312d708169.zip
cpython-ffd3a4217a557bad4984621c22f5ae312d708169.tar.gz
cpython-ffd3a4217a557bad4984621c22f5ae312d708169.tar.bz2
Shutdown subprocess debugger and associated Proxies/Adapters when closing
the Idle debugger. M PyShell.py : Call RemoteDebugger.close_remote_debugger() M RemoteDebugger.py: Add close_remote_debugger(); further polish code used to start the debugger sections. M rpc.py : Add comments on Idlefork methods register(), unregister() comment out unused methods M run.py : Add stop_the_debugger(); polish code
Diffstat (limited to 'Lib/idlelib/rpc.py')
-rw-r--r--Lib/idlelib/rpc.py62
1 files changed, 40 insertions, 22 deletions
diff --git a/Lib/idlelib/rpc.py b/Lib/idlelib/rpc.py
index 35a2678..60a6335 100644
--- a/Lib/idlelib/rpc.py
+++ b/Lib/idlelib/rpc.py
@@ -55,25 +55,48 @@ class RPCServer(SocketServer.TCPServer):
def __init__(self, addr, handlerclass=None):
if handlerclass is None:
handlerclass = RPCHandler
- self.objtable = objecttable
+# XXX KBK 25Jun02 Not used in Idlefork, see register/unregister note below.
+# self.objtable = objecttable
SocketServer.TCPServer.__init__(self, addr, handlerclass)
- def verify_request(self, request, client_address):
- host, port = client_address
- if host != "127.0.0.1":
- print "Disallowed host:", host
- return 0
- else:
- return 1
-
- def register(self, oid, object):
- self.objtable[oid] = object
-
- def unregister(self, oid):
- try:
- del self.objtable[oid]
- except KeyError:
- pass
+ # XXX KBK 25Jun02 Following method is not used (yet)
+# def verify_request(self, request, client_address):
+# host, port = client_address
+# if host != "127.0.0.1":
+# print "Disallowed host:", host
+# return 0
+# else:
+# return 1
+
+# XXX KBK 25Jun02 The handlerclass is expected to provide register/unregister
+# methods. In Idle, RPCServer is instantiated with
+# handlerclass MyHandler, which in turn inherits the
+# register/unregister methods from the mix-in class SocketIO.
+# It is true that this is asymmetric with the RPCClient's use
+# of register/unregister, but I guess that's how a SocketServer
+# is supposed to work.
+
+# Exactly how this gets set up is convoluted. When the
+# TCPServer is instantiated, it creates an instance of
+# run.MyHandler and calls its handle() method. handle()
+# instantiates a run.Executive, passing it a reference to the
+# MyHandler object. That reference is saved as an attribute of
+# the Executive instance. The Executive methods have access to
+# the reference and can pass it on to entities that they
+# command (e.g. RemoteDebugger.Debugger.start_debugger()). The
+# latter, in turn, can call MyHandler(SocketIO)
+# register/unregister methods via the reference to register and
+# unregister themselves. Whew.
+
+ # The following two methods are not currently used in Idlefork.
+# def register(self, oid, object):
+# self.objtable[oid] = object
+
+# def unregister(self, oid):
+# try:
+# del self.objtable[oid]
+# except KeyError:
+# pass
objecttable = {}
@@ -198,11 +221,6 @@ class SocketIO:
pass
else:
raise getattr(__import__(mod), name)(*args)
-# XXX KBK 15Jun02 mod is False here, also want to raise remaining exceptions
-# else:
-# if mod:
-# name = mod + "." + name
-# raise name, args
raise name, args
if how == "ERROR":
raise RuntimeError, what