From a62b0077cce5b0cd8e4dabee9e8af92d31883838 Mon Sep 17 00:00:00 2001
From: Per Cederqvist <ceder@lysator.liu.se>
Date: Tue, 7 Oct 2003 14:25:10 +0000
Subject: [PATCH] (telnet.__init__): Don't forget to call the base class.
 (telnet.close): New method. (telnet.fileno): New method removed. (impl.re):
 Use repr to format the strings in the debug statement.

---
 pcl_expect.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/pcl_expect.py b/pcl_expect.py
index 8c8e90f..bb8d3bc 100644
--- a/pcl_expect.py
+++ b/pcl_expect.py
@@ -154,6 +154,7 @@ class spawn(expectable):
 class telnet(expectable):
     def __init__(self, host, port):
         self.telnet = telnetlib.Telnet(host, port)
+        expectable.__init__(self, self.telnet.fileno())
 
     def _read(self):
         try:
@@ -165,8 +166,8 @@ class telnet(expectable):
     def send(self, s):
         self.telnet.write(s)
 
-    def fileno(self):
-        return self.telnet.fileno()
+    def close(self):
+        self.telnet.close()
 
 class impl:
     def __init__(self, timeout = None):
@@ -262,8 +263,8 @@ class impl:
 
         self.__fill_buffer(exp)
 
-        debug("does \"%s\" match \"%s\" (fd %d)?" % (
-            exp.buffer(), regexp, exp.fileno()))
+        debug("does %s match %s (fd %d)?" % (
+            repr(exp.buffer()), repr(regexp), exp.fileno()))
 
         # Doing this compilation again and again could be a problem.
         # I rely on the cache in module re.  I hope it exists...
-- 
GitLab