Open olejorgenb opened 1 month ago
I'm seeing this when I use yappi in combination with unittest.mock and Python 3.12. Removing any of those three elements fixes the issue. Here's a repro:
from unittest import mock
import yappi
if __name__ == "__main__":
yappi.start()
mock.MagicMock()
yappi.stop()
Traceback:
Traceback (most recent call last):
File "/Users/santorella/miniconda3/envs/ax_312_test/lib/python3.12/unittest/mock.py", line 656, in __getattr__
elif self._mock_methods is not None:
^^^^^^^^^^^^^^^^^^
File "/Users/santorella/miniconda3/envs/ax_312_test/lib/python3.12/unittest/mock.py", line 655, in __getattr__
raise AttributeError(name)
AttributeError: _mock_methods
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "[...]/test_debug.py", line 15, in <module>
mock.MagicMock()
File "/Users/santorella/miniconda3/envs/ax_312_test/lib/python3.12/unittest/mock.py", line 2119, in __init__
def __init__(self, /, *args, **kw):
SystemError: <sys.legacy_event_handler object at 0x1010a1370> returned a result with an exception set
My program fails when trying to profile using yappi through 3.12 (works fine with cProfile)