Skip to content

Commit dad9100

Browse files
committed
Merge commit '23db9c62272' into kenjin_tier2_inliner_redux
2 parents e84eeed + 23db9c6 commit dad9100

32 files changed

+583
-311
lines changed

.devcontainer/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ENV WASI_SDK_VERSION=20
66
ENV WASI_SDK_PATH=/opt/wasi-sdk
77

88
ENV WASMTIME_HOME=/opt/wasmtime
9-
ENV WASMTIME_VERSION=14.0.4
9+
ENV WASMTIME_VERSION=18.0.2
1010
ENV WASMTIME_CPU_ARCH=x86_64
1111

1212
RUN dnf -y --nodocs --setopt=install_weak_deps=False install /usr/bin/{blurb,clang,curl,git,ln,tar,xz} 'dnf-command(builddep)' && \

Include/internal/pycore_opcode_metadata.h

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Include/internal/pycore_optimizer.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,14 @@ extern _Py_UopsSymbol *_Py_uop_sym_new_type(
9797
_Py_UOpsContext *ctx, PyTypeObject *typ);
9898
extern _Py_UopsSymbol *_Py_uop_sym_new_const(_Py_UOpsContext *ctx, PyObject *const_val);
9999
extern _Py_UopsSymbol *_Py_uop_sym_new_null(_Py_UOpsContext *ctx);
100+
extern bool _Py_uop_sym_has_type(_Py_UopsSymbol *sym);
100101
extern bool _Py_uop_sym_matches_type(_Py_UopsSymbol *sym, PyTypeObject *typ);
101102
extern bool _Py_uop_sym_set_null(_Py_UopsSymbol *sym);
102103
extern bool _Py_uop_sym_set_non_null(_Py_UopsSymbol *sym);
103104
extern bool _Py_uop_sym_set_type(_Py_UopsSymbol *sym, PyTypeObject *typ);
104105
extern bool _Py_uop_sym_set_const(_Py_UopsSymbol *sym, PyObject *const_val);
105106
extern bool _Py_uop_sym_is_bottom(_Py_UopsSymbol *sym);
107+
extern int _Py_uop_sym_truthiness(_Py_UopsSymbol *sym);
106108

107109

108110
extern int _Py_uop_abstractcontext_init(_Py_UOpsContext *ctx);

Include/internal/pycore_uop_ids.h

Lines changed: 20 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Include/internal/pycore_uop_metadata.h

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Lib/test/libregrtest/main.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -384,15 +384,10 @@ def run_tests_sequentially(self, runtests) -> None:
384384

385385
result = self.run_test(test_name, runtests, tracer)
386386

387-
# Unload the newly imported test modules (best effort
388-
# finalization). To work around gh-115490, don't unload
389-
# test.support.interpreters and its submodules even if they
390-
# weren't loaded before.
391-
keep = "test.support.interpreters"
387+
# Unload the newly imported test modules (best effort finalization)
392388
new_modules = [module for module in sys.modules
393389
if module not in save_modules and
394-
module.startswith(("test.", "test_"))
395-
and not module.startswith(keep)]
390+
module.startswith(("test.", "test_"))]
396391
for module in new_modules:
397392
sys.modules.pop(module, None)
398393
# Remove the attribute of the parent module.

Lib/test/test__xxinterpchannels.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818
channels = import_helper.import_module('_xxinterpchannels')
1919

2020

21+
# Additional tests are found in Lib/test/test_interpreters/test_channels.py.
22+
# New tests should be added there.
23+
# XXX The tests here should be moved there. See the note under LowLevelTests.
24+
25+
2126
##################################
2227
# helpers
2328

Lib/test/test_capi/test_opt.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,8 @@ def testfunc(a):
331331
ex = get_first_executor(testfunc)
332332
self.assertIsNotNone(ex)
333333
uops = get_opnames(ex)
334-
self.assertIn("_GUARD_IS_NOT_NONE_POP", uops)
334+
self.assertNotIn("_GUARD_IS_NONE_POP", uops)
335+
self.assertNotIn("_GUARD_IS_NOT_NONE_POP", uops)
335336

336337
def test_pop_jump_if_not_none(self):
337338
def testfunc(a):
@@ -347,7 +348,8 @@ def testfunc(a):
347348
ex = get_first_executor(testfunc)
348349
self.assertIsNotNone(ex)
349350
uops = get_opnames(ex)
350-
self.assertIn("_GUARD_IS_NONE_POP", uops)
351+
self.assertNotIn("_GUARD_IS_NONE_POP", uops)
352+
self.assertNotIn("_GUARD_IS_NOT_NONE_POP", uops)
351353

352354
def test_pop_jump_if_true(self):
353355
def testfunc(n):

Lib/test/test_interpreters/test_channels.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import importlib
12
import threading
23
from textwrap import dedent
34
import unittest
@@ -11,6 +12,24 @@
1112
from .utils import _run_output, TestBase
1213

1314

15+
class LowLevelTests(TestBase):
16+
17+
# The behaviors in the low-level module is important in as much
18+
# as it is exercised by the high-level module. Therefore the
19+
# most # important testing happens in the high-level tests.
20+
# These low-level tests cover corner cases that are not
21+
# encountered by the high-level module, thus they
22+
# mostly shouldn't matter as much.
23+
24+
# Additional tests are found in Lib/test/test__xxinterpchannels.py.
25+
# XXX Those should be either moved to LowLevelTests or eliminated
26+
# in favor of high-level tests in this file.
27+
28+
def test_highlevel_reloaded(self):
29+
# See gh-115490 (https://github.com/python/cpython/issues/115490).
30+
importlib.reload(channels)
31+
32+
1433
class TestChannels(TestBase):
1534

1635
def test_create(self):

Lib/test/test_interpreters/test_queues.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import importlib
12
import threading
23
from textwrap import dedent
34
import unittest
@@ -20,6 +21,20 @@ def tearDown(self):
2021
pass
2122

2223

24+
class LowLevelTests(TestBase):
25+
26+
# The behaviors in the low-level module is important in as much
27+
# as it is exercised by the high-level module. Therefore the
28+
# most # important testing happens in the high-level tests.
29+
# These low-level tests cover corner cases that are not
30+
# encountered by the high-level module, thus they
31+
# mostly shouldn't matter as much.
32+
33+
def test_highlevel_reloaded(self):
34+
# See gh-115490 (https://github.com/python/cpython/issues/115490).
35+
importlib.reload(queues)
36+
37+
2338
class QueueTests(TestBase):
2439

2540
def test_create(self):

Lib/test/test_list.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@ def imul(a, b): a *= b
9696
self.assertRaises((MemoryError, OverflowError), mul, lst, n)
9797
self.assertRaises((MemoryError, OverflowError), imul, lst, n)
9898

99+
def test_empty_slice(self):
100+
x = []
101+
x[:] = x
102+
self.assertEqual(x, [])
103+
99104
def test_list_resize_overflow(self):
100105
# gh-97616: test new_allocated * sizeof(PyObject*) overflow
101106
# check in list_resize()

Lib/test/test_typing.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5867,6 +5867,12 @@ def foo(a: 'Node[T'):
58675867
with self.assertRaises(SyntaxError):
58685868
get_type_hints(foo)
58695869

5870+
def test_syntax_error_empty_string(self):
5871+
for form in [typing.List, typing.Set, typing.Type, typing.Deque]:
5872+
with self.subTest(form=form):
5873+
with self.assertRaises(SyntaxError):
5874+
form['']
5875+
58705876
def test_name_error(self):
58715877

58725878
def foo(a: 'Noode[T]'):

Lib/typing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -880,7 +880,7 @@ def __init__(self, arg, is_argument=True, module=None, *, is_class=False):
880880
# If we do `def f(*args: *Ts)`, then we'll have `arg = '*Ts'`.
881881
# Unfortunately, this isn't a valid expression on its own, so we
882882
# do the unpacking manually.
883-
if arg[0] == '*':
883+
if arg.startswith('*'):
884884
arg_to_compile = f'({arg},)[0]' # E.g. (*Ts,)[0] or (*tuple[int, int],)[0]
885885
else:
886886
arg_to_compile = arg
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Get WASI builds to work under wasmtime 18 w/ WASI 0.2/preview2 primitives.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
:mod:`typing`: raise :exc:`SyntaxError` instead of :exc:`AttributeError`
2+
on forward references as empty strings.

0 commit comments

Comments
 (0)