Issue 33120: infinite loop in inspect.unwrap(unittest.mock.call) (original) (raw)
Issue33120
Created on 2018-03-22 13:36 by peterdemin, last changed 2022-04-11 14:58 by admin. This issue is now closed.
Messages (4) | ||
---|---|---|
msg314254 - (view) | Author: Peter (peterdemin) | Date: 2018-03-22 13:36 |
The following module will eat all available RAM if executed: import inspect import unittest.mock print(inspect.unwrap(unittest.mock.call)) inspect.unwrap has loop protection against functions that wrap themselves, but unittest.mock.call creates new object on demand. | ||
msg314270 - (view) | Author: Peter (peterdemin) | Date: 2018-03-22 16:15 |
I see two options to fix it: 1) add recursion depth check to inspect.wrap 2) define __wrapped__ on mock._Call so it won't go into recursion. | ||
msg314303 - (view) | Author: (ppperry) | Date: 2018-03-23 11:22 |
This is a dupe of https://bugs.python.org/issue25532 | ||
msg314351 - (view) | Author: Terry J. Reedy (terry.reedy) * ![]() |
Date: 2018-03-24 01:26 |
Peter, please include x.y.z version with reports (and upgrade first if possible ;-). This was apparently fixed in #25532 last year for current versions. With 3.6.4 and 3.7.0b2 I get Traceback (most recent call last): File "F:\Python\a\tem2.py", line 3, in print(inspect.unwrap(unittest.mock.call)) File "C:\Programs\Python37\lib\inspect.py", line 515, in unwrap raise ValueError('wrapper loop when unwrapping {!r}'.format(f)) ValueError: wrapper loop when unwrapping call |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-11 14:58:58 | admin | set | github: 77301 |
2018-07-15 19:25:47 | ppperry | set | type: crash -> behavior |
2018-03-24 01:26:54 | terry.reedy | set | status: open -> closedsuperseder: infinite loop when running inspect.unwrap over unittest.mock.callnosy: + terry.reedymessages: + resolution: out of datestage: resolved |
2018-03-23 11:22:56 | ppperry | set | nosy: + ppperrymessages: + |
2018-03-22 16:15:31 | peterdemin | set | messages: + |
2018-03-22 13:36:41 | peterdemin | create |