[Zope-Checkins] CVS: Packages/ZServer/medusa/thread - thread_channel.py:1.4
Fred L. Drake, Jr.
fdrake@acm.org
Tue, 26 Feb 2002 23:40:21 -0500
Update of /cvs-repository/Packages/ZServer/medusa/thread
In directory cvs.zope.org:/tmp/cvs-serv27437/medusa/thread
Modified Files:
thread_channel.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/medusa/thread/thread_channel.py 1.3 => 1.4 ===
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 @@
# 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.