summaryrefslogtreecommitdiffstats
path: root/Include
ModeNameSize
-rw-r--r--Python-ast.h20081logstatsplain
-rw-r--r--Python.h4300logstatsplain
-rw-r--r--abstract.h43484logstatsplain
-rw-r--r--asdl.h1099logstatsplain
-rw-r--r--ast.h230logstatsplain
-rw-r--r--bitset.h792logstatsplain
-rw-r--r--boolobject.h912logstatsplain
-rw-r--r--bufferobject.h922logstatsplain
-rw-r--r--bytes_methods.h3269logstatsplain
-rw-r--r--bytesobject.h1744logstatsplain
-rw-r--r--cStringIO.h2001logstatsplain
-rw-r--r--cellobject.h651logstatsplain
-rw-r--r--ceval.h4944logstatsplain
-rw-r--r--classobject.h2939logstatsplain
-rw-r--r--cobject.h1761logstatsplain
-rw-r--r--code.h3524logstatsplain
-rw-r--r--codecs.h5014logstatsplain
-rw-r--r--compile.h1157logstatsplain
-rw-r--r--complexobject.h1474logstatsplain
-rw-r--r--datetime.h8268logstatsplain
-rw-r--r--descrobject.h2104logstatsplain
-rw-r--r--dictobject.h5769logstatsplain
-rw-r--r--enumobject.h253logstatsplain
-rw-r--r--errcode.h1363logstatsplain
-rw-r--r--eval.h557logstatsplain
-rw-r--r--fileobject.h2356logstatsplain
-rw-r--r--floatobject.h4574logstatsplain
-rw-r--r--formatter_string.h263logstatsplain
-rw-r--r--formatter_unicode.h267logstatsplain
-rw-r--r--frameobject.h2923logstatsplain
-rw-r--r--funcobject.h2995logstatsplain
-rw-r--r--genobject.h891logstatsplain
-rw-r--r--graminit.h1876logstatsplain
-rw-r--r--grammar.h2021logstatsplain
-rw-r--r--import.h2025logstatsplain
-rw-r--r--intobject.h2528logstatsplain
-rw-r--r--intrcheck.h274logstatsplain
-rw-r--r--iterobject.h522logstatsplain
-rw-r--r--listobject.h2513logstatsplain
-rw-r--r--longintrepr.h2318logstatsplain
-rw-r--r--longobject.h5346logstatsplain
-rw-r--r--marshal.h713logstatsplain
-rw-r--r--metagrammar.h253logstatsplain
-rw-r--r--methodobject.h3238logstatsplain
-rw-r--r--modsupport.h5024logstatsplain
-rw-r--r--moduleobject.h609logstatsplain
-rw-r--r--node.h890logstatsplain
-rw-r--r--object.h35936logstatsplain
-rw-r--r--objimpl.h12426logstatsplain
-rw-r--r--opcode.h4341logstatsplain
-rw-r--r--osdefs.h942logstatsplain
-rw-r--r--parsetok.h1780logstatsplain
-rw-r--r--patchlevel.h1421logstatsplain
-rw-r--r--pgen.h253logstatsplain
-rw-r--r--pgenheaders.h1144logstatsplain
-rw-r--r--py_curses.h4165logstatsplain
-rw-r--r--pyarena.h2693logstatsplain
-rw-r--r--pydebug.h1240logstatsplain
-rw-r--r--pyerrors.h11754logstatsplain
-rw-r--r--pyexpat.h1957logstatsplain
-rw-r--r--pyfpe.h8495logstatsplain
-rw-r--r--pygetopt.h306logstatsplain
-rw-r--r--pymactoolbox.h7421logstatsplain
-rw-r--r--pymem.h3808logstatsplain
-rw-r--r--pyport.h26068logstatsplain
-rw-r--r--pystate.h6203logstatsplain
-rw-r--r--pystrcmp.h436logstatsplain
-rw-r--r--pystrtod.h359logstatsplain
-rw-r--r--pythonrun.h6667logstatsplain
-rw-r--r--pythread.h1376logstatsplain
-rw-r--r--rangeobject.h646logstatsplain
-rw-r--r--setobject.h2975logstatsplain
-rw-r--r--sliceobject.h1289logstatsplain
-rw-r--r--stringobject.h6626logstatsplain
-rw-r--r--structmember.h2675logstatsplain
-rw-r--r--structseq.h862logstatsplain
-rw-r--r--symtable.h3934logstatsplain
-rw-r--r--sysmodule.h819logstatsplain
-rw-r--r--timefuncs.h442logstatsplain
-rw-r--r--token.h1710logstatsplain
-rw-r--r--traceback.h622logstatsplain
-rw-r--r--tupleobject.h2123logstatsplain
-rw-r--r--ucnhash.h861logstatsplain
-rw-r--r--unicodeobject.h49654logstatsplain
-rw-r--r--weakrefobject.h2428logstatsplain
t.""" self.collect_children() pid = os.fork() if pid: # Parent process if self.active_children is None: self.active_children = [] self.active_children.append(pid) return else: # Child process. # This must never return, hence os._exit()! try: self.socket.close() self.finish_request(request, client_address) os._exit(0) except: try: self.handle_error(request, client_address) finally: os._exit(1) class ThreadingMixIn: """Mix-in class to handle each request in a new thread.""" def process_request(self, request, client_address): """Start a new thread to process the request.""" import threading t = threading.Thread(target = self.finish_request, args = (request, client_address)) t.start() class ForkingUDPServer(ForkingMixIn, UDPServer): pass class ForkingTCPServer(ForkingMixIn, TCPServer): pass class ThreadingUDPServer(ThreadingMixIn, UDPServer): pass class ThreadingTCPServer(ThreadingMixIn, TCPServer): pass if hasattr(socket, 'AF_UNIX'): class UnixStreamServer(TCPServer): address_family = socket.AF_UNIX class UnixDatagramServer(UDPServer): address_family = socket.AF_UNIX class ThreadingUnixStreamServer(ThreadingMixIn, UnixStreamServer): pass class ThreadingUnixDatagramServer(ThreadingMixIn, UnixDatagramServer): pass class BaseRequestHandler: """Base class for request handler classes. This class is instantiated for each request to be handled. The constructor sets the instance variables request, client_address and server, and then calls the handle() method. To implement a specific service, all you need to do is to derive a class which defines a handle() method. The handle() method can find the request as self.request, the client address as self.client_address, and the server (in case it needs access to per-server information) as self.server. Since a separate instance is created for each request, the handle() method can define arbitrary other instance variariables. """ def __init__(self, request, client_address, server): self.request = request self.client_address = client_address self.server = server try: self.setup() self.handle() self.finish() finally: sys.exc_traceback = None # Help garbage collection def setup(self): pass def __del__(self): pass def handle(self): pass def finish(self): pass # The following two classes make it possible to use the same service # class for stream or datagram servers. # Each class sets up these instance variables: # - rfile: a file object from which receives the request is read # - wfile: a file object to which the reply is written # When the handle() method returns, wfile is flushed properly class StreamRequestHandler(BaseRequestHandler): """Define self.rfile and self.wfile for stream sockets.""" # Default buffer sizes for rfile, wfile. # We default rfile to buffered because otherwise it could be # really slow for large data (a getc() call per byte); we make # wfile unbuffered because (a) often after a write() we want to # read and we need to flush the line; (b) big writes to unbuffered # files are typically optimized by stdio even when big reads # aren't. rbufsize = -1 wbufsize = 0 def setup(self): self.connection = self.request self.rfile = self.connection.makefile('rb', self.rbufsize) self.wfile = self.connection.makefile('wb', self.wbufsize) def finish(self): self.wfile.flush() self.wfile.close() self.rfile.close() class DatagramRequestHandler(BaseRequestHandler): """Define self.rfile and self.wfile for datagram sockets.""" def setup(self): import StringIO self.packet, self.socket = self.request self.rfile = StringIO.StringIO(self.packet) self.wfile = StringIO.StringIO(self.packet) def finish(self): self.socket.sendto(self.wfile.getvalue(), self.client_address)