diff options
author | Jeff Forcier <jeff@bitprophet.org> | 2014-09-05 10:39:00 -0700 |
---|---|---|
committer | Jeff Forcier <jeff@bitprophet.org> | 2014-09-05 10:39:00 -0700 |
commit | 0e0460f85942e79c94b7db9d93abdf60bf1dbac4 (patch) | |
tree | 152b80b4a2822abcb85136f7fbc7f9263279eb14 /tests/loop.py | |
parent | 683b3c22893be899d2fdbf1ada35e61fba8a3d70 (diff) | |
parent | eb7da84bee49f6e7b568ee00fd5f3db0bb29f36a (diff) |
Merge branch 'master' into 131-int
Diffstat (limited to 'tests/loop.py')
-rw-r--r-- | tests/loop.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/loop.py b/tests/loop.py index ffa8e3c4..4f5dc163 100644 --- a/tests/loop.py +++ b/tests/loop.py @@ -7,7 +7,7 @@ # Software Foundation; either version 2.1 of the License, or (at your option) # any later version. # -# Paramiko is distrubuted in the hope that it will be useful, but WITHOUT ANY +# Paramiko is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # details. @@ -21,6 +21,7 @@ """ import threading, socket +from paramiko.common import asbytes class LoopSocket (object): @@ -31,7 +32,7 @@ class LoopSocket (object): """ def __init__(self): - self.__in_buffer = '' + self.__in_buffer = bytes() self.__lock = threading.Lock() self.__cv = threading.Condition(self.__lock) self.__timeout = None @@ -41,11 +42,12 @@ class LoopSocket (object): self.__unlink() try: self.__lock.acquire() - self.__in_buffer = '' + self.__in_buffer = bytes() finally: self.__lock.release() def send(self, data): + data = asbytes(data) if self.__mate is None: # EOF raise EOFError() @@ -57,7 +59,7 @@ class LoopSocket (object): try: if self.__mate is None: # EOF - return '' + return bytes() if len(self.__in_buffer) == 0: self.__cv.wait(self.__timeout) if len(self.__in_buffer) == 0: |