Skip to content

Commit 2a66249

Browse files
committed
[GR-45794] The Python EE standalone includes LLVM EE.
PullRequest: graalpython/2813
2 parents 27aa283 + 8d562f2 commit 2a66249

File tree

6 files changed

+51
-27
lines changed

6 files changed

+51
-27
lines changed

ci.jsonnet

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{ "overlay": "e61df4b2dde96b3c9b488ab7cde6b011d719db79" }
1+
{ "overlay": "6aa4b65fe934daaad9ab3358e8955add43914296" }

graalpython/com.oracle.graal.python.test/src/tests/unittest_tags/test_codecs.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
*graalpython.lib-python.3.test.test_codecs.ExceptionChainingTest.test_non_str_arg_is_not_wrapped
4848
*graalpython.lib-python.3.test.test_codecs.ExceptionChainingTest.test_unflagged_non_text_codec_handling
4949
*graalpython.lib-python.3.test.test_codecs.IDNACodecTest.test_builtin_decode
50+
*graalpython.lib-python.3.test.test_codecs.IDNACodecTest.test_builtin_decode_length_limit
5051
*graalpython.lib-python.3.test.test_codecs.IDNACodecTest.test_builtin_encode
5152
*graalpython.lib-python.3.test.test_codecs.IDNACodecTest.test_errors
5253
*graalpython.lib-python.3.test.test_codecs.IDNACodecTest.test_incremental_decode

graalpython/lib-python/3/encodings/idna.py

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -39,23 +39,21 @@ def nameprep(label):
3939

4040
# Check bidi
4141
RandAL = [stringprep.in_table_d1(x) for x in label]
42-
for c in RandAL:
43-
if c:
44-
# There is a RandAL char in the string. Must perform further
45-
# tests:
46-
# 1) The characters in section 5.8 MUST be prohibited.
47-
# This is table C.8, which was already checked
48-
# 2) If a string contains any RandALCat character, the string
49-
# MUST NOT contain any LCat character.
50-
if any(stringprep.in_table_d2(x) for x in label):
51-
raise UnicodeError("Violation of BIDI requirement 2")
52-
53-
# 3) If a string contains any RandALCat character, a
54-
# RandALCat character MUST be the first character of the
55-
# string, and a RandALCat character MUST be the last
56-
# character of the string.
57-
if not RandAL[0] or not RandAL[-1]:
58-
raise UnicodeError("Violation of BIDI requirement 3")
42+
if any(RandAL):
43+
# There is a RandAL char in the string. Must perform further
44+
# tests:
45+
# 1) The characters in section 5.8 MUST be prohibited.
46+
# This is table C.8, which was already checked
47+
# 2) If a string contains any RandALCat character, the string
48+
# MUST NOT contain any LCat character.
49+
if any(stringprep.in_table_d2(x) for x in label):
50+
raise UnicodeError("Violation of BIDI requirement 2")
51+
# 3) If a string contains any RandALCat character, a
52+
# RandALCat character MUST be the first character of the
53+
# string, and a RandALCat character MUST be the last
54+
# character of the string.
55+
if not RandAL[0] or not RandAL[-1]:
56+
raise UnicodeError("Violation of BIDI requirement 3")
5957

6058
return label
6159

@@ -103,6 +101,16 @@ def ToASCII(label):
103101
raise UnicodeError("label empty or too long")
104102

105103
def ToUnicode(label):
104+
if len(label) > 1024:
105+
# Protection from https://github.com/python/cpython/issues/98433.
106+
# https://datatracker.ietf.org/doc/html/rfc5894#section-6
107+
# doesn't specify a label size limit prior to NAMEPREP. But having
108+
# one makes practical sense.
109+
# This leaves ample room for nameprep() to remove Nothing characters
110+
# per https://www.rfc-editor.org/rfc/rfc3454#section-3.1 while still
111+
# preventing us from wasting time decoding a big thing that'll just
112+
# hit the actual <= 63 length limit in Step 6.
113+
raise UnicodeError("label way too long")
106114
# Step 1: Check for ASCII
107115
if isinstance(label, bytes):
108116
pure_ascii = True

graalpython/lib-python/3/test/test_codecs.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1534,6 +1534,12 @@ def test_builtin_encode(self):
15341534
self.assertEqual("pyth\xf6n.org".encode("idna"), b"xn--pythn-mua.org")
15351535
self.assertEqual("pyth\xf6n.org.".encode("idna"), b"xn--pythn-mua.org.")
15361536

1537+
def test_builtin_decode_length_limit(self):
1538+
with self.assertRaisesRegex(UnicodeError, "way too long"):
1539+
(b"xn--016c"+b"a"*1100).decode("idna")
1540+
with self.assertRaisesRegex(UnicodeError, "too long"):
1541+
(b"xn--016c"+b"a"*70).decode("idna")
1542+
15371543
def test_stream(self):
15381544
r = codecs.getreader("idna")(io.BytesIO(b"abc"))
15391545
r.read(3)

mx.graalpython/mx_graalpython.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1982,6 +1982,12 @@ def verify_ci(dest_suite, common_ci_dir="ci_common", args=None, ext=('.jsonnet',
19821982
))
19831983

19841984

1985+
standalone_dependencies_common = {
1986+
'LLVM Runtime Core': ('lib/sulong', []),
1987+
'LLVM Runtime Native': ('lib/sulong', []),
1988+
'LLVM.org toolchain': ('lib/llvm-toolchain', []),
1989+
}
1990+
19851991
mx_sdk.register_graalvm_component(mx_sdk.GraalVmLanguage(
19861992
suite=SUITE,
19871993
name='GraalVM Python',
@@ -1999,12 +2005,15 @@ def verify_ci(dest_suite, common_ci_dir="ci_common", args=None, ext=('.jsonnet',
19992005
'TRegex',
20002006
'ICU4J',
20012007
],
2002-
standalone_dependencies={
2003-
'LLVM Runtime Core': ('lib/sulong', []),
2004-
'LLVM Runtime Native': ('lib/sulong', []),
2005-
'LLVM.org toolchain': ('lib/llvm-toolchain', []),
2008+
standalone_dependencies={**standalone_dependencies_common, **{
20062009
'GraalVM Python license files': ('', []),
2007-
},
2010+
}},
2011+
standalone_dependencies_enterprise={**standalone_dependencies_common, **{
2012+
'LLVM Runtime Enterprise': ('lib/sulong', []),
2013+
'LLVM Runtime Native Enterprise': ('lib/sulong', []),
2014+
'GraalVM Python license files EE': ('', []),
2015+
'GraalVM enterprise license files': ('', ['LICENSE.txt', 'GRAALVM-README.md']),
2016+
}},
20082017
truffle_jars=[
20092018
'graalpython:GRAALPYTHON',
20102019
'graalpython:BOUNCYCASTLE-PROVIDER',

mx.graalpython/suite.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,31 +44,31 @@
4444
},
4545
{
4646
"name": "sdk",
47-
"version": "67b2258fa2beec2152939fade4dbc6a7a146123b",
47+
"version": "bf9b50cc88c919c0858c782a03d1badd6382a8d4",
4848
"subdir": True,
4949
"urls": [
5050
{"url": "https://github.com/oracle/graal", "kind": "git"},
5151
]
5252
},
5353
{
5454
"name": "tools",
55-
"version": "67b2258fa2beec2152939fade4dbc6a7a146123b",
55+
"version": "bf9b50cc88c919c0858c782a03d1badd6382a8d4",
5656
"subdir": True,
5757
"urls": [
5858
{"url": "https://github.com/oracle/graal", "kind": "git"},
5959
],
6060
},
6161
{
6262
"name": "sulong",
63-
"version": "67b2258fa2beec2152939fade4dbc6a7a146123b",
63+
"version": "bf9b50cc88c919c0858c782a03d1badd6382a8d4",
6464
"subdir": True,
6565
"urls": [
6666
{"url": "https://github.com/oracle/graal", "kind": "git"},
6767
]
6868
},
6969
{
7070
"name": "regex",
71-
"version": "67b2258fa2beec2152939fade4dbc6a7a146123b",
71+
"version": "bf9b50cc88c919c0858c782a03d1badd6382a8d4",
7272
"subdir": True,
7373
"urls": [
7474
{"url": "https://github.com/oracle/graal", "kind": "git"},

0 commit comments

Comments
 (0)