Hello, I've noticed that the logic in py-compile is built on assumptions from Python 2 and does not fit Python 3 well. Notably, there are two or three bugs here: 1. .opt-2 (-OO) level is not compiled for py3.5+. 2. .opt-1 (-O) and .opt-2 (-OO) are wrongly skipped for PyPy3. Firstly, the code in py-compile byte-compiles in two steps: without '-O' and with '-O'. This is correct for Python <3.5 since '-O' and '-OO' share the same file (.pyo). However, since Python 3.5 they are written into separate '.opt-1.pyc' and '.opt-2.pyc' files and therefore can coexist. It is therefore necessary to perform another byte-compilation step with '-OO', so that all levels of optimization are installed and the module can be correctly loaded from cache independently of Python options used. Secondly, the code in '-O' block skips PyPy based on the existence of sys.pypy_translation_info. This is correct for PyPy2 that doesn't write optimized caches. However, PyPy3 (in particular versions based on Python 3.5 and newer, I'm not sure about the older versions) do use the same split naming scheme as CPython. Therefore, the check here needs to be modified to apply only to Python 2 versions of PyPy. To reproduce: touch mytest.py cat > configure.ac < Makefile.am <