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

Fred L. Drake, Jr. fdrake@acm.org
Tue, 26 Feb 2002 23:40:21 -0500


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

Modified Files:
	__init__.py 
Log Message:
Clean up FCNTL imports differently, and catch the remaining import of that
module.  My *hope* is that this takes care of the single deprecation warning
produced when running the regression tests on the trunk with Python 2.2.


=== Packages/ZServer/__init__.py 1.24 => 1.25 ===
 try:
     import fcntl
-    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
+    try:
+        from fcntl import F_SETFD, FD_CLOEXEC
+    except ImportError:
+        from FCNTL import F_SETFD, FD_CLOEXEC
+
     def requestCloseOnExec(sock):
-        try:    fcntl.fcntl(sock.fileno(), fcntl.F_SETFD, fcntl.FD_CLOEXEC)
+        try:    fcntl.fcntl(sock.fileno(), F_SETFD, FD_CLOEXEC)
         except: pass
 
 except (ImportError, AttributeError):