Commit 4a1c11c8 authored by Fred Drake's avatar Fred Drake

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.
parent 3719aac9
......@@ -66,13 +66,13 @@ except:
# processes from Zope code. Thanks to Dieter Maurer for this.
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):
......
# -*- Mode: Python; tab-width: 4 -*-
VERSION_STRING = "$Id: thread_channel.py,v 1.3 2001/05/01 11:45:27 andreas Exp $"
VERSION_STRING = "$Id: thread_channel.py,v 1.4 2002/02/27 04:40:20 fdrake Exp $"
# This will probably only work on Unix.
......@@ -14,12 +14,16 @@ import asyncore
import asynchat
import fcntl
import FCNTL
import os
import socket
import string
import thread
try:
from fcntl import F_GETFL, F_SETFL, O_NDELAY
except ImportError:
from FCNTL import F_GETFL, F_SETFL, O_NDELAY
# this channel slaves off of another one. it starts a thread which
# pumps its output through the 'write' side of the pipe. The 'read'
# side of the pipe will then notify us when data is ready. We push
......@@ -42,8 +46,8 @@ class thread_channel (asyncore.file_dispatcher):
# The read side of the pipe is set to non-blocking I/O; it is
# 'owned' by medusa.
flags = fcntl.fcntl (rfd, FCNTL.F_GETFL, 0)
fcntl.fcntl (rfd, FCNTL.F_SETFL, flags | FCNTL.O_NDELAY)
flags = fcntl.fcntl (rfd, F_GETFL, 0)
fcntl.fcntl (rfd, F_SETFL, flags | O_NDELAY)
# The write side of the pipe is left in blocking mode; it is
# 'owned' by the thread. However, we wrap it up as a file object.
......
......@@ -66,13 +66,13 @@ except:
# processes from Zope code. Thanks to Dieter Maurer for this.
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):
......
# -*- Mode: Python; tab-width: 4 -*-
VERSION_STRING = "$Id: thread_channel.py,v 1.3 2001/05/01 11:45:27 andreas Exp $"
VERSION_STRING = "$Id: thread_channel.py,v 1.4 2002/02/27 04:40:20 fdrake Exp $"
# This will probably only work on Unix.
......@@ -14,12 +14,16 @@ import asyncore
import asynchat
import fcntl
import FCNTL
import os
import socket
import string
import thread
try:
from fcntl import F_GETFL, F_SETFL, O_NDELAY
except ImportError:
from FCNTL import F_GETFL, F_SETFL, O_NDELAY
# this channel slaves off of another one. it starts a thread which
# pumps its output through the 'write' side of the pipe. The 'read'
# side of the pipe will then notify us when data is ready. We push
......@@ -42,8 +46,8 @@ class thread_channel (asyncore.file_dispatcher):
# The read side of the pipe is set to non-blocking I/O; it is
# 'owned' by medusa.
flags = fcntl.fcntl (rfd, FCNTL.F_GETFL, 0)
fcntl.fcntl (rfd, FCNTL.F_SETFL, flags | FCNTL.O_NDELAY)
flags = fcntl.fcntl (rfd, F_GETFL, 0)
fcntl.fcntl (rfd, F_SETFL, flags | O_NDELAY)
# The write side of the pipe is left in blocking mode; it is
# 'owned' by the thread. However, we wrap it up as a file object.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment