]> granicus.if.org Git - python/commitdiff
Bug #1469163: SimpleXMLRPCServer unconditionally attempted to import fcntl.
authorAnthony Baxter <anthonybaxter@gmail.com>
Wed, 12 Apr 2006 12:07:31 +0000 (12:07 +0000)
committerAnthony Baxter <anthonybaxter@gmail.com>
Wed, 12 Apr 2006 12:07:31 +0000 (12:07 +0000)
Wrapped in a try/except.

Lib/SimpleXMLRPCServer.py
Misc/NEWS

index 052a8e4aed8607d5adb9d03eea07848f2f43dc88..abf8b4998de7c15750554775172e0a4e7c89834a 100644 (file)
@@ -104,7 +104,11 @@ from xmlrpclib import Fault
 import SocketServer
 import BaseHTTPServer
 import sys
-import os, fcntl
+import os
+try:
+    import fcntl
+except ImportError:
+    fcntl = None
 
 def resolve_dotted_attribute(obj, attr, allow_dotted_names=True):
     """resolve_dotted_attribute(a, 'b.c.d') => a.b.c.d
@@ -493,7 +497,7 @@ class SimpleXMLRPCServer(SocketServer.TCPServer,
         # [Bug #1222790] If possible, set close-on-exec flag; if a
         # method spawns a subprocess, the subprocess shouldn't have
         # the listening socket open.
-        if hasattr(fcntl, 'FD_CLOEXEC'):
+        if fcntl is not None and hasattr(fcntl, 'FD_CLOEXEC'):
             flags = fcntl.fcntl(self.fileno(), fcntl.F_GETFD)
             flags |= fcntl.FD_CLOEXEC
             fcntl.fcntl(self.fileno(), fcntl.F_SETFD, flags)
index 4dacebd081b89ee26cd20527941e1969d5c488af..1e242d056c1e7af8a1535da1654e1f908006091a 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -49,6 +49,9 @@ Extension Modules
 Library
 -------
 
+- SimpleXMLRPCServer relied on the fcntl module, which is unavailable on
+  Windows. Bug #1469163.
+
 - The warnings, linecache, inspect, traceback, site, and doctest modules
   were updated to work correctly with modules imported from zipfiles or
   via other PEP 302 __loader__ objects.