[issue13771] HTTPSConnection __init__ super implementation causes recursion error

Martin Panter report at bugs.python.org
Sat Jun 4 21:15:43 EDT 2016


Martin Panter added the comment:

My guess is Michael was doing something like

>>> class Monkey(http.client.HTTPSConnection):
...     pass
... 
>>> http.client.HTTPSConnection = Monkey
>>> http.client.HTTPSConnection("bugs.python.org")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.5/http/client.py", line 1210, in __init__
    source_address)
  [. . .]
  File "/usr/lib/python3.5/http/client.py", line 1210, in __init__
    source_address)
  File "/usr/lib/python3.5/http/client.py", line 1209, in __init__
    super(HTTPSConnection, self).__init__(host, port, timeout,
RecursionError: maximum recursion depth exceeded while calling a Python object

Looking at <https://github.com/cdent/wsgi-intercept/commit/d70dfa9>, I think this problem has been overcome by also overriding __init__(). IMO Python shouldn’t go very far out of its way to support monkey patching, and in this case the workaround was disliked by Eric. Given these two facts and no apparent interest since, I think we should close this.

----------
nosy: +martin.panter

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13771>
_______________________________________


More information about the Python-bugs-list mailing list