Backport a Python issue13146 to Python 2.7 on EL 7
This bug causes mysterious, nondeterministic crash of Python applications.
https://bugs.python.org/issue13146
Writing a pyc file is not atomic
The Python 2.7 patch https://bugs.python.org/file30324/13146-2.7.patch works fine.
It would help if we could backport it to the Python 2.7 in the upcoming EL 7.5 release.
Nice to have another patch that fixes a selftest failure too. https://bugs.python.org/issue31158: read returns 5 bytes only.
Thanks.
Responses
I logged bugs against the EL7 python component for you:
- Red Hat Private Bug 1512159 - python: Writing a pyc file is not atomic
- Red Hat Private Bug 1512160 - python: test_pty: test_basic() fails randomly on Travis CI
If you have a Red Hat Bugzilla account, let me know it and I'll add you to the bug CC, or I can just report back any updates here.
Hello and thanks for your report.
While that specific issue was fixed in python3, the same fix was deemed too intrusive for python2 by upstream.
Also as soon as this issue was introduced in python3 some things broke (see https://bugs.python.org/issue17222 ) and from the RHEL perspective, we need to be really careful with making any changes that might break use cases/setups/code etc that relied on the previous behaviours, even implicitly.
From a higher level overview, code which brings python2 closer to python3's behaviour can introduce unexpected regressions, as it has happened in the past.
What is the severity of the issue and what is your use case?
In regards to the failure of test_pty, that is a reasonable request and will be evaluated, since it will make the python builds fail randomly and it can disrupt workflows and CI infrastructures for anyone who rebuilds from source.
From the Python point of view, best practice would be pre-compiling the .pyc files (e.g. with python -m compileall), and shipping them with the code. Automatic compiling/caching is nice for development, but if you're at the point of deploying to multiple hosts, compile once for all of them.
This might not work for one-off scripts; there you might want to set PYHTONDONTWRITEBYTECODE as a workaround.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
