andymccurdy/redis-py — pull request #244 by giltayar (2012-05-16 11:03:41+00:00)
Title: Open socket connection with mode='rb' instead of 'r' to support IronPython

Open socket connection with mode='rb' instead of 'r'.
From Python documentation: ...when opening a binary file, you should append 'b' to the mode value to open the file in binary mode, which will improve portability. (Appending 'b' is useful even on systems that don’t treat binary and text files differently, where it serves as documentation.)

Without this, ironpython kills the last byte of each line of the response, because it assumes a \r\n at the end of the line, but gets only \n, because IronPython newline-normalizes the string.

I tested this change with IronPython, Python on Windows, and Python on Linux. All tests pass.