Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3d8fc06

Browse filesBrowse files
gh-115859: Disable the tier 2 redundancy eliminator by default (GH-115860)
1 parent e4561e0 commit 3d8fc06
Copy full SHA for 3d8fc06

File tree

Expand file treeCollapse file tree

2 files changed

+9
-3
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+9
-3
lines changed

‎Lib/test/test_capi/test_opt.py

Copy file name to clipboardExpand all lines: Lib/test/test_capi/test_opt.py
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import textwrap
55
import unittest
66
import gc
7+
import os
78

89
import _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.")
571574
class TestUopsOptimization(unittest.TestCase):
572575

573576
def _run_with_optimizer(self, testfunc, arg):

‎Python/optimizer_analysis.c

Copy file name to clipboardExpand all lines: Python/optimizer_analysis.c
+6-3Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff 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;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.