File tree 2 files changed +9
-3
lines changed
2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change 4
4
import textwrap
5
5
import unittest
6
6
import gc
7
+ import os
7
8
8
9
import _testinternalcapi
9
10
@@ -568,6 +569,8 @@ def testfunc(n):
568
569
count = ops .count ("_GUARD_IS_TRUE_POP" ) + ops .count ("_GUARD_IS_FALSE_POP" )
569
570
self .assertLessEqual (count , 2 )
570
571
572
+
573
+ @unittest .skipIf (os .getenv ("PYTHONUOPSOPTIMIZE" , default = 0 ) == 0 , "Needs uop optimizer to run." )
571
574
class TestUopsOptimization (unittest .TestCase ):
572
575
573
576
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(
810
810
811
811
peephole_opt (frame , buffer , buffer_size );
812
812
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
+ }
816
819
817
820
if (err == 0 ) {
818
821
goto not_ready ;
You can’t perform that action at this time.
0 commit comments