diff options
| author | Thomas Kluyver <takowl@gmail.com> | 2013-09-20 18:20:40 -0700 |
|---|---|---|
| committer | Thomas Kluyver <takowl@gmail.com> | 2013-09-20 18:20:40 -0700 |
| commit | 908a94b15db61ae42f7b9cc3406a9192b26c4ef9 (patch) | |
| tree | 9cfb38d0bf53aaf62f69a6264ef76e3bfc009af4 /pexpect | |
| parent | 9c8e069026b55357b63def1bc8a39d567f41a405 (diff) | |
| download | pexpect-908a94b15db61ae42f7b9cc3406a9192b26c4ef9.tar.gz | |
Fix logging tests for Python 3
Diffstat (limited to 'pexpect')
| -rw-r--r-- | pexpect/__init__.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/pexpect/__init__.py b/pexpect/__init__.py index f552e04..0a1df83 100644 --- a/pexpect/__init__.py +++ b/pexpect/__init__.py @@ -92,7 +92,6 @@ __revision__ = '1' __all__ = ['ExceptionPexpect', 'EOF', 'TIMEOUT', 'spawn', 'run', 'which', 'split_command_line', '__version__', '__revision__'] - # Exception classes used by this module. class ExceptionPexpect(Exception): @@ -284,9 +283,11 @@ class spawn(object): @staticmethod def _chr(c): return bytes([c]) + linesep = os.linesep.encode('ascii') else: allowed_string_types = basestring # analysis:ignore _chr = staticmethod(chr) + linesep = os.linesep encoding = None @@ -1048,7 +1049,7 @@ class spawn(object): returns the number of bytes written. ''' n = self.send(s) - n = n + self.send(os.linesep) + n = n + self.send(self.linesep) return n def sendcontrol(self, char): @@ -1729,10 +1730,12 @@ class spawnu(spawn): string_type = str allowed_string_types = str _chr = staticmethod(chr) + linesep = os.linesep else: string_type = unicode allowed_string_types = unicode _chr = staticmethod(unichr) + linesep = os.linesep.decode('ascii') def __init__(self, *args, **kwargs): self.encoding = kwargs.pop('encoding', 'utf-8') |
