uosiu added the comment:
Bardzo proszę :)
This fix is quite important for us. We would like to start using this fix in
our product. Is there something I could do to backport it to 3.9?
--
___
Python tracker
<https://bugs.python.org/issue45
Change by uosiu :
--
keywords: +patch
pull_requests: +26528
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/28085
___
Python tracker
<https://bugs.python.org/issu
New submission from Stanisław Skonieczny (Uosiu)
:
We have an application that crawls filesystem using `os.scandir`. It uses
multiple threads for various things. Application is used on variety of
filesystems, some of them might be slow or occasionally unresponsive.
We have found out that
Stanisław Skonieczny (Uosiu) added the comment:
When you just create a magick mock and then call `__str__` on it, it never
throws an exception and always return a string.
But... when you create a magick mock and then call `__str__` from two
threads concurrently, one of them will raise an
Stanisław Skonieczny (Uosiu) added the comment:
However there is still nothing in the docs that you have to mock `__str__`
by yourself
when using mock object with multiple threads. Otherwise calling `__str__`
may result
with raising exception if you are unlucky.
Stanisław Skonieczny
On Wed
Stanisław Skonieczny (Uosiu) added the comment:
This scripts runs start_threads.py and send a signal to it. After some number
of loops problem can be reproduced.
--
Added file: https://bugs.python.org/file47762/test.sh
___
Python tracker
<ht
New submission from Stanisław Skonieczny (Uosiu)
:
Sometimes when thread is starting it raises "RuntimeError: release unlocked
lock". That is when signal handler is invoked in the same time.
Traceback (most recent call last):
File "/usr/lib/python3.6/threading.py"
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
New submission from Stanisław Skonieczny (Uosiu):
When moving from python 2.7 to 3.5 I have found a problem with patching __new__
method on the class. It was done this way:
'''
patch('foo.bar.MyClass.__new__', return_value=mocked_instance)
'''
In works w