summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorAnthony Baxter <anthonybaxter@gmail.com>2006-04-12 12:07:31 (GMT)
committerAnthony Baxter <anthonybaxter@gmail.com>2006-04-12 12:07:31 (GMT)
commite29002ccb009966bc23d632f534d62bad56d0fd3 (patch)
treebf399008dbb941c65efcd7395317d64661bfc3cd /Lib
parent2db15505be38a0d8a87919f5864d116e4ae74a54 (diff)
downloadcpython-e29002ccb009966bc23d632f534d62bad56d0fd3.zip
cpython-e29002ccb009966bc23d632f534d62bad56d0fd3.tar.gz
cpython-e29002ccb009966bc23d632f534d62bad56d0fd3.tar.bz2
Bug #1469163: SimpleXMLRPCServer unconditionally attempted to import fcntl.
Wrapped in a try/except.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/SimpleXMLRPCServer.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/Lib/SimpleXMLRPCServer.py b/Lib/SimpleXMLRPCServer.py
index 052a8e4..abf8b49 100644
--- a/Lib/SimpleXMLRPCServer.py
+++ b/Lib/SimpleXMLRPCServer.py
@@ -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)