(b)
| 92 | self.allowed_string_types = (bytes, str) |
| 93 | self.linesep = os.linesep.encode('ascii') |
| 94 | def write_to_stdout(b): |
| 95 | try: |
| 96 | return sys.stdout.buffer.write(b) |
| 97 | except AttributeError: |
| 98 | # If stdout has been replaced, it may not have .buffer |
| 99 | return sys.stdout.write(b.decode('ascii', 'replace')) |
| 100 | self.write_to_stdout = write_to_stdout |
| 101 | else: |
| 102 | self.allowed_string_types = (basestring,) # analysis:ignore |