diff -Naur Python-3.5.2-orig/Lib/distutils/cygwinccompiler.py Python-3.5.2/Lib/distutils/cygwinccompiler.py --- Python-3.5.2-orig/Lib/distutils/cygwinccompiler.py 2016-07-12 14:22:13.375300700 +0300 +++ Python-3.5.2/Lib/distutils/cygwinccompiler.py 2016-07-12 14:22:51.701800700 +0300 @@ -305,9 +305,9 @@ raise CCompilerError( 'Cygwin gcc cannot be used with --compiler=mingw32') - self.set_executables(compiler='gcc -O -Wall', - compiler_so='gcc -mdll -O -Wall', - compiler_cxx='g++ -O -Wall', + self.set_executables(compiler='gcc -O2 -Wall', + compiler_so='gcc -mdll -O2 -Wall', + compiler_cxx='g++ -O2 -Wall', linker_exe='gcc', linker_so='%s %s %s' % (self.linker_dll, shared_option,