File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change 44import textwrap
55import unittest
66import gc
7+ import os
78
89import _testinternalcapi
910
@@ -568,6 +569,8 @@ def testfunc(n):
568569 count = ops .count ("_GUARD_IS_TRUE_POP" ) + ops .count ("_GUARD_IS_FALSE_POP" )
569570 self .assertLessEqual (count , 2 )
570571
572+
573+ @unittest .skipIf (os .getenv ("PYTHONUOPSOPTIMIZE" , default = 0 ) == 0 , "Needs uop optimizer to run." )
571574class TestUopsOptimization (unittest .TestCase ):
572575
573576 def _run_with_optimizer (self , testfunc , arg ):
Original file line number Diff line number Diff line change @@ -810,9 +810,12 @@ _Py_uop_analyze_and_optimize(
810810
811811 peephole_opt (frame , buffer , buffer_size );
812812
813- err = uop_redundancy_eliminator (
814- (PyCodeObject * )frame -> f_executable , buffer ,
815- buffer_size , curr_stacklen , dependencies );
813+ char * uop_optimize = Py_GETENV ("PYTHONUOPSOPTIMIZE" );
814+ if (uop_optimize != NULL && * uop_optimize > '0' ) {
815+ err = uop_redundancy_eliminator (
816+ (PyCodeObject * )frame -> f_executable , buffer ,
817+ buffer_size , curr_stacklen , dependencies );
818+ }
816819
817820 if (err == 0 ) {
818821 goto not_ready ;
You can’t perform that action at this time.
0 commit comments