Closed borman closed 5 years ago
There is indeed a side-effect but hunter doesn't use repr by default, it uses https://github.com/ionelmc/python-hunter/blob/master/src/hunter/util.py#L150
Unfortunately, it doesn't help. I only used native repr()
for an easy implementation: as you can verify, this example fails with default safe_repr
as well.
It appears that methods are unsafe to repr (they call repr on the instance). I'll fix this.
Eg:
>>> class Junk:
... def __repr__(self):
... return "Bad Stuff"
... def foo(self): pass
...
>>>
>>> Junk().foo
<bound method Junk.foo of Bad Stuff>
@borman Give the master a try?
Here is a reproducible example: https://gist.github.com/borman/f4b347e87ee3a528c6ac94285084293b
You can see a diff in the execution trace between two runs. Execution flow diverges after client_reqrep.py:875: https://gist.github.com/borman/f4b347e87ee3a528c6ac94285084293b/revisions?diff=unified#diff-3c628d58096772043814ea5c7b40f0b0
The reason for this behaviour is:
repr()
implementation uses these properties: https://github.com/aio-libs/aiohttp/blob/master/aiohttp/client_reqrep.py#L741headers
) are cached in their uninitialized state