STINNER Victor <vstin...@python.org> added the comment:

I proposed a way to fix the issue:

"Maybe the test should copy all .py files of the stdlib into a temporary 
directory and work there, to not impact other tests run in parallel."


Shreyan Avigyan:
> Though I've never been able to reproduce this test failure. Maybe it's fixed 
> (maybe it was a side effect of another test)?

It's a race condition. It's hard to reproduce in a reliable way, but I'm sure 
that it has not been fixed.

The bug happens when one process tries to recreate the .pyc, whereas another 
process has the old .pyc file open. You can maybe make the issue more likely by 
adding a sleep in the code reading pyc content.

For example, in the FileLoader.get_data() method of 
importlib._bootstrap_external. Hacking importlib is non trivial, since the 
Python code is compiled as a frozen module.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue37387>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to