Added a script to check if the bug exists (provided you have an updated strace 4.15 or above).
Without patch:
# ./import_io_check.sh
strace: Requested path 'tmp.py' resolved into '/root/tmp.py'
read(3, 0x55fc3a71cc50, 4096) = -1 ENOSYS (Function not implemented) (INJECTED)
read(3, 0x55fc3a71cc50, 4096) = -1 ENOSYS (Function not implemented) (INJECTED)
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named py
+++ exited with 1 +++
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named py
Bug exists an incorrect .pyc has been produced
With patch:
# PYTHON=Python-2.7.14-with-patch/python ./import_io_check.sh
strace: Requested path 'tmp.py' resolved into '/root/tmp.py'
read(3, 0x55a8ff7d3020, 4096) = -1 ENOSYS (Function not implemented) (INJECTED)
read(3, 0x55a8ff7d3020, 4096) = -1 ENOSYS (Function not implemented) (INJECTED)
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "tmp.py", line 1
^
SyntaxError: unexpected EOF while parsing
+++ exited with 1 +++
Script finished successfully