Closed
Description
Crash report
What happened?
Calling _pickle.load(MagicMock())
with a results in an abort in debug builds and a SystemError
in non-debug.
In debug builds:
python -c "from unittest.mock import MagicMock as MM; from _pickle import load;
load(MM())"
python: Objects/typeobject.c:5583: _PyType_LookupRef: Assertion `!PyErr_Occurred()' failed.
Aborted
In non-debug builds:
python -c "from unittest.mock import MagicMock as MM; from _pickle import load; load(MM())"
TypeError: a bytes-like object is required, not 'MagicMock'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<string>", line 1, in <module>
from unittest.mock import MagicMock as MM; from _pickle import load; load(MM())
~~~~^^^^^^
File "/home/danzin/projects/cpython/Lib/unittest/mock.py", line 1168, in __call__
self._mock_check_sig(*args, **kwargs)
~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
SystemError: <function CallableMixin._mock_check_sig at 0x7feb149cf8a0> returned a result with an exception set
Found using fusil by @vstinner.
CPython versions tested on:
3.13, 3.14, CPython main branch
Operating systems tested on:
Linux, Windows
Output from running 'python -VV' on the command line:
Python 3.14.0a1+ experimental free-threading build (heads/main-dirty:bfc1d2504c, Nov 4 2024, 07:55:58) [GCC 11.4.0]
Linked PRs
Metadata
Metadata
Assignees
Labels
Projects
Status
Done