New submission from Stanisław Skonieczny (Uosiu): This bug results in raising TypeError: __str__ returned non-string (type MagicMock) Following program can reproduce it:
``` from threading import Thread from mock.mock import MagicMock def main(): mocks = [MagicMock() for _ in range(1000)] def in_thread(): for m in mocks: str(m) threads = [Thread(target=in_thread) for _ in range(10)] for thread in threads: thread.start() for thread in threads: thread.join() if __name__ == '__main__': main() ``` For me it rasies few times: ``` Exception in thread Thread-6: Traceback (most recent call last): File "/usr/local/lib/python3.5/threading.py", line 923, in _bootstrap_inner self.run() File "/usr/local/lib/python3.5/threading.py", line 871, in run self._target(*self._args, **self._kwargs) File "../misc/magic_mock_str_bug.py", line 11, in in_thread str(m) TypeError: __str__ returned non-string (type MagicMock) ``` ---------- components: Library (Lib) messages: 262104 nosy: Stanisław Skonieczny (Uosiu) priority: normal severity: normal status: open title: MagickMock __str__ sometimes returns MagickMock instead of str type: behavior versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26600> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com