HTTPretty
HTTPretty copied to clipboard
Infinite recursion with python 3.4.2
Due to this python issue (20386) there is the possibility of an infinite recursion when calling socket.__repr__
in python 3.4.2. HTTPretty patches socket.SocketType
, which it assumes is the actual class of the socket, like in Python 2.7. In Python 3.4.2 they inadvertently made it an Enum with all the different socket types. The problem is they use this Enum in the socket's __repr__
to output the socket's type, but since HTTPretty has substituted the fake socket class for the enum the result is a new socket object is created. And when it's __repr__
method is called the same things happen again and again and again. This isn't a bug in HTTPretty, and by the end of the month it will have been fixed with Python 3.4.3, but I thought I would mention it here because it wasted half my day and if someone else had written about it I would probably have spent it more productively.
Just a heads up that there is a proposed solution for this in https://github.com/gabrielfalcao/HTTPretty/pull/193
I was hit by this two days ago, it was a nightmare to debug : http://stackoverflow.com/questions/29590459/http-request-with-python-typeerror-an-integer-is-required-got-type-socket