[Zope-Checkins] CVS: Packages/ZServer - __init__.py:1.23

Fred L. Drake, Jr. fdrake@acm.org
Mon, 25 Feb 2002 23:36:05 -0500


Update of /cvs-repository/Packages/ZServer
In directory cvs.zope.org:/tmp/cvs-serv12498

Modified Files:
	__init__.py 
Log Message:
Fix one more unchecked use of the FCNTL module.

=== Packages/ZServer/__init__.py 1.22 => 1.23 ===
 try:
     import fcntl, FCNTL
-    FCNTL.F_SETFD; FCNTL.FD_CLOEXEC
+    if not (hasattr(fcntl, 'F_SETFD') and hasattr(fcntl, 'FD_CLOEXEC')):
+        # hack to be compatible with Python versions pre-2.2
+        import FCNTL
+        fcntl.F_SETFD = FCNTL.F_SETFD
+        fcntl.FD_CLOEXEC = FCNTL.FD_CLOEXEC
     def requestCloseOnExec(sock):
-        try:    fcntl.fcntl(sock.fileno(), FCNTL.F_SETFD, FCNTL.FD_CLOEXEC)
+        try:    fcntl.fcntl(sock.fileno(), fcntl.F_SETFD, fcntl.FD_CLOEXEC)
         except: pass
 
 except (ImportError, AttributeError):