summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorBrett Simmers <swtaarrs@users.noreply.github.com>2024-03-01 02:53:32 (GMT)
committerGitHub <noreply@github.com>2024-03-01 02:53:32 (GMT)
commit339c8e1c13adc299a0e2e49c93067e7817692380 (patch)
tree4d2c0708d04ea383b533115e83ec4f49fbf826e7 /Lib/test
parent2e94a6687c1a9750e9d2408a8dff0a422aeaf0e4 (diff)
downloadcpython-339c8e1c13adc299a0e2e49c93067e7817692380.zip
cpython-339c8e1c13adc299a0e2e49c93067e7817692380.tar.gz
cpython-339c8e1c13adc299a0e2e49c93067e7817692380.tar.bz2
gh-115999: Disable the specializing adaptive interpreter in free-threaded builds (#116013)
For now, disable all specialization when the GIL might be disabled.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_capi/test_opt.py6
-rw-r--r--Lib/test/test_generated_cases.py8
-rw-r--r--Lib/test/test_monitoring.py5
-rw-r--r--Lib/test/test_opcache.py4
-rw-r--r--Lib/test/test_type_cache.py3
5 files changed, 23 insertions, 3 deletions
diff --git a/Lib/test/test_capi/test_opt.py b/Lib/test/test_capi/test_opt.py
index d217653..f4fcdea 100644
--- a/Lib/test/test_capi/test_opt.py
+++ b/Lib/test/test_capi/test_opt.py
@@ -8,7 +8,7 @@ import os
import _testinternalcapi
-from test.support import script_helper
+from test.support import script_helper, requires_specialization
@contextlib.contextmanager
@@ -31,6 +31,7 @@ def clear_executors(func):
func.__code__ = func.__code__.replace()
+@requires_specialization
class TestOptimizerAPI(unittest.TestCase):
def test_new_counter_optimizer_dealloc(self):
@@ -133,6 +134,7 @@ def get_opnames(ex):
return set(iter_opnames(ex))
+@requires_specialization
class TestExecutorInvalidation(unittest.TestCase):
def setUp(self):
@@ -211,6 +213,7 @@ class TestExecutorInvalidation(unittest.TestCase):
self.assertIsNone(exe)
+@requires_specialization
@unittest.skipIf(os.getenv("PYTHON_UOPS_OPTIMIZE") == "0", "Needs uop optimizer to run.")
class TestUops(unittest.TestCase):
@@ -572,6 +575,7 @@ class TestUops(unittest.TestCase):
self.assertLessEqual(count, 2)
+@requires_specialization
@unittest.skipIf(os.getenv("PYTHON_UOPS_OPTIMIZE") == "0", "Needs uop optimizer to run.")
class TestUopsOptimization(unittest.TestCase):
diff --git a/Lib/test/test_generated_cases.py b/Lib/test/test_generated_cases.py
index 6fcb5d5..32c2c2f 100644
--- a/Lib/test/test_generated_cases.py
+++ b/Lib/test/test_generated_cases.py
@@ -350,12 +350,15 @@ class TestGeneratedCases(unittest.TestCase):
output = """
TARGET(OP) {
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
+ (void)this_instr;
next_instr += 4;
INSTRUCTION_STATS(OP);
PyObject *value;
value = stack_pointer[-1];
uint16_t counter = read_u16(&this_instr[1].cache);
+ (void)counter;
uint32_t extra = read_u32(&this_instr[2].cache);
+ (void)extra;
stack_pointer += -1;
DISPATCH();
}
@@ -399,6 +402,7 @@ class TestGeneratedCases(unittest.TestCase):
INSTRUCTION_STATS(OP);
PREDICTED(OP);
_Py_CODEUNIT *this_instr = next_instr - 6;
+ (void)this_instr;
PyObject *right;
PyObject *left;
PyObject *arg2;
@@ -408,6 +412,7 @@ class TestGeneratedCases(unittest.TestCase):
left = stack_pointer[-2];
{
uint16_t counter = read_u16(&this_instr[1].cache);
+ (void)counter;
op1(left, right);
}
/* Skip 2 cache entries */
@@ -415,6 +420,7 @@ class TestGeneratedCases(unittest.TestCase):
arg2 = stack_pointer[-3];
{
uint32_t extra = read_u32(&this_instr[4].cache);
+ (void)extra;
res = op2(arg2, left, right);
}
stack_pointer[-3] = res;
@@ -424,6 +430,7 @@ class TestGeneratedCases(unittest.TestCase):
TARGET(OP1) {
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
+ (void)this_instr;
next_instr += 2;
INSTRUCTION_STATS(OP1);
PyObject *right;
@@ -431,6 +438,7 @@ class TestGeneratedCases(unittest.TestCase):
right = stack_pointer[-1];
left = stack_pointer[-2];
uint16_t counter = read_u16(&this_instr[1].cache);
+ (void)counter;
op1(left, right);
DISPATCH();
}
diff --git a/Lib/test/test_monitoring.py b/Lib/test/test_monitoring.py
index 2fd8220..b027959 100644
--- a/Lib/test/test_monitoring.py
+++ b/Lib/test/test_monitoring.py
@@ -9,6 +9,7 @@ import textwrap
import types
import unittest
import asyncio
+from test.support import requires_specialization
PAIR = (0,1)
@@ -815,6 +816,9 @@ class ExceptionMonitoringTest(CheckEvents):
self.check_events(func1, [("raise", KeyError)])
+ # gh-116090: This test doesn't really require specialization, but running
+ # it without specialization exposes a monitoring bug.
+ @requires_specialization
def test_implicit_stop_iteration(self):
def gen():
@@ -963,6 +967,7 @@ class ExceptionMonitoringTest(CheckEvents):
)
self.assertEqual(events[0], ("throw", IndexError))
+ @requires_specialization
def test_no_unwind_for_shim_frame(self):
class B:
diff --git a/Lib/test/test_opcache.py b/Lib/test/test_opcache.py
index 2b2783d..5fb4b81 100644
--- a/Lib/test/test_opcache.py
+++ b/Lib/test/test_opcache.py
@@ -4,7 +4,7 @@ import dis
import threading
import types
import unittest
-from test.support import threading_helper, check_impl_detail
+from test.support import threading_helper, check_impl_detail, requires_specialization
# Skip this module on other interpreters, it is cpython specific:
if check_impl_detail(cpython=False):
@@ -506,6 +506,7 @@ class TestCallCache(unittest.TestCase):
@threading_helper.requires_working_threading()
+@requires_specialization
class TestRacesDoNotCrash(unittest.TestCase):
# Careful with these. Bigger numbers have a higher chance of catching bugs,
# but you can also burn through a *ton* of type/dict/function versions:
@@ -1021,6 +1022,7 @@ class TestRacesDoNotCrash(unittest.TestCase):
class C:
pass
+@requires_specialization
class TestInstanceDict(unittest.TestCase):
def setUp(self):
diff --git a/Lib/test/test_type_cache.py b/Lib/test/test_type_cache.py
index 58572c6..e90e315 100644
--- a/Lib/test/test_type_cache.py
+++ b/Lib/test/test_type_cache.py
@@ -2,7 +2,7 @@
import unittest
import dis
from test import support
-from test.support import import_helper
+from test.support import import_helper, requires_specialization
try:
from sys import _clear_type_cache
except ImportError:
@@ -94,6 +94,7 @@ class TypeCacheTests(unittest.TestCase):
@support.cpython_only
+@requires_specialization
class TypeCacheWithSpecializationTests(unittest.TestCase):
def tearDown(self):
_clear_type_cache()