Skip to content

Commit c9db161

Browse files
committed
Merge branch 'main' into 3.6
2 parents c309c62 + 13bc0f1 commit c9db161

14 files changed

Lines changed: 165 additions & 48 deletions

eng/scripts/generate.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,13 @@ def finally_block(self):
120120
self.writeline("} finally {")
121121
self.indent()
122122

123-
def exit_block(self, text=None, **kw):
123+
def exit_block(self, text=None):
124124
self.dedent()
125125
if text:
126-
self.writeline("} " + text, **kw)
126+
if text == ";":
127+
self.writeline("}" + text)
128+
else:
129+
self.writeline("} " + text)
127130
else:
128131
self.writeline('}')
129132

eng/scripts/generate_encoding_aliases.py

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,44 @@
33
# See the LICENSE file in the project root for more information.
44

55
import encodings
6+
import itertools
7+
import sys
68

79
from generate import generate
810

911
def gen_aliases(cw):
1012
cw.writeline("// Based on encodings.aliases")
1113
cw.enter_block("var d = new Dictionary<string, string>")
1214

13-
for codec in sorted(set(encodings.aliases.aliases.values())):
15+
aliases = encodings.aliases.aliases
16+
aliases_36 = {
17+
"kz_1048": "kz1048",
18+
"rk1048": "kz1048",
19+
"strk1048_2002": "kz1048",
20+
}
21+
codecs_36 = {v: "PYTHON_36_OR_GREATER" for v in aliases_36.values()}
22+
if sys.version_info >= (3, 6):
23+
for k, v in aliases_36.items():
24+
assert aliases[k] == v
25+
aliases = {**aliases, **aliases_36}
26+
27+
sorted_aliases = sorted(aliases.items(), key=lambda kv: (kv[1], kv[0]))
28+
for codec, group in itertools.groupby(sorted_aliases, key=lambda kv: kv[1]):
29+
condition = codecs_36.get(codec)
30+
1431
e = encodings.search_function(codec)
15-
if e is None or not e._is_text_encoding or e.name == "mbcs":
32+
if not condition and (e is None or not e._is_text_encoding or e.name == "mbcs"):
1633
continue
1734

1835
cw.writeline()
19-
aliases = sorted(alias for alias, aliased_codec in encodings.aliases.aliases.items() if aliased_codec == codec)
20-
for alias in aliases:
36+
if condition:
37+
cw.writeline("#if {0}".format(condition))
38+
for alias, codec in group:
2139
qalias = '"{0}"'.format(alias)
2240
qcodec = '"{0}"'.format(codec)
2341
cw.writeline('{{ {0:24} , {1:24} }},'.format(qalias, qcodec))
42+
if condition:
43+
cw.writeline("#endif")
2444

2545
cw.exit_block(";")
2646

src/core/IronPython/IronPython.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
<EmbeddedResource Include="Modules\unicodedata\IPyUnicodeData.txt.gz" />
6464
<EmbeddedResource Include="Modules\unicodedata\IPyUnicodeData-3.2.0.txt.gz" />
6565
<EmbeddedResource Include="..\IronPython.StdLib\lib\importlib\_bootstrap.py" Link="Modules\_bootstrap.py" />
66-
<EmbeddedResource Include="..\IronPython.StdLib\lib\importlib\_bootstrap_external.py" Link="Modules\_bootstrap_external.py" />
66+
<EmbeddedResource Condition="'$(MajorVersion)$(MinorVersion)' >= '36'" Include="..\IronPython.StdLib\lib\importlib\_bootstrap_external.py" Link="Modules\_bootstrap_external.py" />
6767
</ItemGroup>
6868

6969
<ItemGroup>

src/core/IronPython/Runtime/Operations/StringOps.Generated.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,9 +253,11 @@ static partial class CodecsInfo {
253253

254254
{ "cskoi8r" , "koi8_r" },
255255

256+
#if PYTHON_36_OR_GREATER
256257
{ "kz_1048" , "kz1048" },
257258
{ "rk1048" , "kz1048" },
258259
{ "strk1048_2002" , "kz1048" },
260+
#endif
259261

260262
{ "8859" , "latin_1" },
261263
{ "cp819" , "latin_1" },
@@ -320,7 +322,7 @@ static partial class CodecsInfo {
320322
{ "utf8" , "utf_8" },
321323
{ "utf8_ucs2" , "utf_8" },
322324
{ "utf8_ucs4" , "utf_8" },
323-
} ;
325+
};
324326

325327
// *** END GENERATED CODE ***
326328

tests/IronPython.Tests/Cases/CPythonCasesManifest.ini

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -531,9 +531,8 @@ Reason=Only valid for Unix
531531
[CPython.test_gzip]
532532
IsolationLevel=PROCESS # https://github.com/IronLanguages/ironpython3/issues/1440
533533

534-
# TODO: 3.6
535-
#[CPython.test_heapq]
536-
#Ignore=true
534+
[CPython.test_heapq] # IronPython.test_heapq_stdlib
535+
Ignore=true
537536

538537
[CPython.test_httplib] # IronPython.test_httplib_stdlib
539538
Ignore=true
@@ -833,10 +832,8 @@ RunCondition=$(IS_POSIX)
833832
Ignore=true
834833
Reason=unittest.case.SkipTest: No module named 'readline'
835834

836-
# TODO: 3.6
837-
[CPython.test_regrtest]
838-
IsolationLevel=PROCESS
839-
#Ignore=true # lots of failures
835+
[CPython.test_regrtest] # IronPython.test_regrtest_stdlib
836+
Ignore=true
840837

841838
[CPython.test_reprlib]
842839
Ignore=true

tests/IronPython.Tests/Cases/IronPythonCasesManifest.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@ RetryCount=2
105105
IsolationLevel=PROCESS
106106
Arguments=-X:CompilationThreshold 0 "$(TEST_FILE)" # ensure CompilationThreshold is 0 otherwise tests are meaningless!
107107

108+
[IronPython.test_regrtest_stdlib]
109+
IsolationLevel=PROCESS
110+
108111
[IronPython.test_set_stdlib]
109112
RunCondition=NOT $(IS_MONO) # weakref failures; https://github.com/IronLanguages/ironpython3/issues/544
110113
IsolationLevel=PROCESS # Also weakref failures; https://github.com/IronLanguages/ironpython3/issues/489

tests/suite/test_datetime_stdlib.py

Lines changed: 9 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ def load_tests(loader, standard_tests, pattern):
1919
failing_tests = [
2020
test.datetimetester.TestDate('test_backdoor_resistance'),
2121
test.datetimetester.TestDate('test_insane_fromtimestamp'),
22-
test.datetimetester.TestDateTime('test_backdoor_resistance'),
2322
test.datetimetester.TestDateTime('test_extreme_timedelta'),
2423
test.datetimetester.TestDateTime('test_insane_fromtimestamp'),
2524
test.datetimetester.TestDateTime('test_insane_utcfromtimestamp'),
@@ -46,6 +45,10 @@ def load_tests(loader, standard_tests, pattern):
4645
test.datetimetester.TestTimeTZ('test_zones'),
4746
test.datetimetester.TestTimeZone('test_constructor'),
4847
]
48+
if sys.version_info < (3, 6):
49+
failing_tests += [
50+
test.datetimetester.TestDateTime('test_backdoor_resistance'),
51+
]
4952
if sys.version_info >= (3, 6):
5053
failing_tests += [
5154
test.datetimetester.IranTest('test_folds'), # https://github.com/IronLanguages/ironpython3/issues/1459
@@ -60,10 +63,12 @@ def load_tests(loader, standard_tests, pattern):
6063
test.datetimetester.TestDateTime('test_compat_unpickle'), # TypeError: function takes at least 3 arguments (1 given)
6164
test.datetimetester.TestDateTime('test_isoformat'), # TypeError: isoformat() got an unexpected keyword argument 'timespec'
6265
test.datetimetester.TestDateTime('test_subclass_replace'), # TypeError: replace() got an unexpected keyword argument 'year'
66+
test.datetimetester.TestDateTime('test_timestamp_limits'), # ValueError: The added or subtracted value results in an un-representable DateTime.
6367
test.datetimetester.TestDateTimeTZ('test_bad_constructor_arguments'), # https://github.com/IronLanguages/ironpython3/issues/1459
6468
test.datetimetester.TestDateTimeTZ('test_compat_unpickle'), # TypeError: function takes at least 3 arguments (2 given)
6569
test.datetimetester.TestDateTimeTZ('test_isoformat'), # TypeError: isoformat() got an unexpected keyword argument 'timespec'
6670
test.datetimetester.TestDateTimeTZ('test_subclass_replace'), # TypeError: replace() got an unexpected keyword argument 'year'
71+
test.datetimetester.TestDateTimeTZ('test_timestamp_limits'), # ValueError: The added or subtracted value results in an un-representable DateTime.
6772
test.datetimetester.TestLocalTimeDisambiguation('test_comparison'), # https://github.com/IronLanguages/ironpython3/issues/1459
6873
test.datetimetester.TestLocalTimeDisambiguation('test_constructors'), # https://github.com/IronLanguages/ironpython3/issues/1459
6974
test.datetimetester.TestLocalTimeDisambiguation('test_dst'), # https://github.com/IronLanguages/ironpython3/issues/1459
@@ -82,35 +87,11 @@ def load_tests(loader, standard_tests, pattern):
8287
test.datetimetester.TestLocalTimeDisambiguation('test_vilnius_1941_toutc'), # AssertionError: '06/23/41 19:59:59 ' != 'Mon Jun 23 19:59:59 1941 UTC'
8388
test.datetimetester.TestModule('test_divide_and_round'), # AttributeError: 'module' object has no attribute '_divide_and_round'
8489
test.datetimetester.TestSubclassDateTime('test_bad_constructor_arguments'), # https://github.com/IronLanguages/ironpython3/issues/1459
90+
test.datetimetester.TestSubclassDateTime('test_combine'), # TypeError: combine() takes exactly 2 arguments (3 given)
91+
test.datetimetester.TestSubclassDateTime('test_compat_unpickle'), # TypeError: function takes at least 3 arguments (1 given)
8592
test.datetimetester.TestSubclassDateTime('test_isoformat'), # TypeError: isoformat() got an unexpected keyword argument 'timespec'
8693
test.datetimetester.TestSubclassDateTime('test_subclass_replace'), # TypeError: replace() got an unexpected keyword argument 'year'
87-
test.datetimetester.TestTime('test_backdoor_resistance'), # AssertionError: "^bad tzinfo state arg$" does not match "expected Int32, got bytes"
88-
test.datetimetester.TestTime('test_compat_unpickle'), # TypeError: expected Int32, got str
89-
test.datetimetester.TestTime('test_isoformat'), # TypeError: isoformat() takes no arguments (1 given)
90-
test.datetimetester.TestTime('test_subclass_replace'), # AssertionError: <class '_datetime.time'> is not <class 'test.datetimetester.TimeSubclass'>
91-
test.datetimetester.TestTimeDelta('test_issue31293'), # ZeroDivisionError: Attempted to divide by zero.
92-
test.datetimetester.TestTimeTZ('test_backdoor_resistance'), # AssertionError: "^bad tzinfo state arg$" does not match "expected Int32, got bytes"
93-
test.datetimetester.TestTimeTZ('test_compat_unpickle'), # TypeError: expected Int32, got str
94-
test.datetimetester.TestTimeTZ('test_isoformat'), # TypeError: isoformat() takes no arguments (1 given)
95-
test.datetimetester.TestTimeTZ('test_subclass_replace'), # AssertionError: <class '_datetime.time'> is not <class 'test.datetimetester.TimeSubclass'>
96-
test.datetimetester.ZoneInfoTest('test_folds'), # https://github.com/IronLanguages/ironpython3/issues/1459
97-
test.datetimetester.ZoneInfoTest('test_gaps'), # https://github.com/IronLanguages/ironpython3/issues/1459
98-
test.datetimetester.ZoneInfoTest('test_system_transitions'), # AttributeError: 'module' object has no attribute 'tzset'
99-
test.datetimetester.TestSubclassDateTime('test_subclass_replace'), # TypeError: replace() got an unexpected keyword argument 'year'
100-
test.datetimetester.TestTime('test_backdoor_resistance'), # AssertionError: "^bad tzinfo state arg$" does not match "expected Int32, got bytes"
101-
test.datetimetester.TestTime('test_compat_unpickle'), # TypeError: expected Int32, got str
102-
test.datetimetester.TestTime('test_isoformat'), # TypeError: isoformat() takes no arguments (1 given)
103-
test.datetimetester.TestTime('test_subclass_replace'), # AssertionError: <class '_datetime.time'> is not <class 'test.datetimetester.TimeSubclass'>
104-
test.datetimetester.TestTimeDelta('test_computations'), # rounding differences
105-
test.datetimetester.TestTimeDelta('test_issue31293'), # ZeroDivisionError: Attempted to divide by zero.
106-
test.datetimetester.TestTimeTZ('test_backdoor_resistance'), # AssertionError: "^bad tzinfo state arg$" does not match "expected Int32, got bytes"
107-
test.datetimetester.TestTimeTZ('test_compat_unpickle'), # TypeError: expected Int32, got str
108-
test.datetimetester.TestTimeTZ('test_isoformat'), # TypeError: isoformat() takes no arguments (1 given)
109-
test.datetimetester.TestTimeTZ('test_subclass_replace'), # AssertionError: <class '_datetime.time'> is not <class 'test.datetimetester.TimeSubclass'>
110-
test.datetimetester.ZoneInfoTest('test_folds'), # https://github.com/IronLanguages/ironpython3/issues/1459
111-
test.datetimetester.ZoneInfoTest('test_gaps'), # https://github.com/IronLanguages/ironpython3/issues/1459
112-
test.datetimetester.ZoneInfoTest('test_system_transitions'), # AttributeError: 'module' object has no attribute 'tzset'
113-
test.datetimetester.TestSubclassDateTime('test_subclass_replace'), # TypeError: replace() got an unexpected keyword argument 'year'
94+
test.datetimetester.TestSubclassDateTime('test_timestamp_limits'), # ValueError: The added or subtracted value results in an un-representable DateTime.
11495
test.datetimetester.TestTime('test_backdoor_resistance'), # AssertionError: "^bad tzinfo state arg$" does not match "expected Int32, got bytes"
11596
test.datetimetester.TestTime('test_compat_unpickle'), # TypeError: expected Int32, got str
11697
test.datetimetester.TestTime('test_isoformat'), # TypeError: isoformat() takes no arguments (1 given)

tests/suite/test_heapq_stdlib.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Licensed to the .NET Foundation under one or more agreements.
2+
# The .NET Foundation licenses this file to you under the Apache 2.0 License.
3+
# See the LICENSE file in the project root for more information.
4+
5+
##
6+
## Run selected tests from test_heapq from StdLib
7+
##
8+
9+
import sys
10+
11+
from iptest import is_ironpython, generate_suite, run_test
12+
13+
import test.test_heapq
14+
15+
def load_tests(loader, standard_tests, pattern):
16+
tests = loader.loadTestsFromModule(test.test_heapq, pattern=pattern)
17+
18+
if is_ironpython:
19+
failing_tests = []
20+
if sys.version_info >= (3, 6):
21+
failing_tests += [
22+
test.test_heapq.TestErrorHandlingC('test_comparison_operator_modifiying_heap'), # TypeError: '<' not supported between instances of 'EvilClass' and 'int'
23+
test.test_heapq.TestErrorHandlingC('test_comparison_operator_modifiying_heap_two_heaps'), # AssertionError: (<class 'IndexError'>, <class 'RuntimeError'>) not raised by heappush
24+
test.test_heapq.TestErrorHandlingPython('test_comparison_operator_modifiying_heap'), # TypeError: '<' not supported between instances of 'EvilClass' and 'int'
25+
test.test_heapq.TestModules('test_c_functions'), # AssertionError: 'heapq' != '_heapq'
26+
]
27+
28+
skip_tests = []
29+
30+
return generate_suite(tests, failing_tests, skip_tests)
31+
32+
else:
33+
return tests
34+
35+
run_test(__name__)

tests/suite/test_io_stdlib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ def load_tests(loader, standard_tests, pattern):
8383
test.test_io.CMiscIOTest('test_readinto_buffer_overflow'), # IndexError: Index was outside the bounds of the array.
8484
test.test_io.CMiscIOTest('test_warn_on_dealloc'), # AssertionError: ResourceWarning not triggered
8585
test.test_io.CMiscIOTest('test_warn_on_dealloc_fd'), # AssertionError: ResourceWarning not triggered
86-
test.test_io.PyMiscIOTest('test_io_after_close'), # AttributeError: 'FileIO' object has no attribute 'read1'
8786
test.test_io.PyMiscIOTest('test_nonblock_pipe_write_bigbuf'), # AttributeError: 'module' object has no attribute 'fcntl'
8887
test.test_io.PyMiscIOTest('test_nonblock_pipe_write_smallbuf'), # AttributeError: 'module' object has no attribute 'fcntl'
8988
test.test_io.PyMiscIOTest('test_warn_on_dealloc'), # AssertionError: ResourceWarning not triggered
@@ -102,6 +101,7 @@ def load_tests(loader, standard_tests, pattern):
102101
test.test_io.CBufferedWriterTest('test_garbage_collection'), # AssertionError: filter ('', ResourceWarning) did not catch any warning
103102
test.test_io.CBufferedRandomTest('test_garbage_collection'), # AssertionError: filter ('', ResourceWarning) did not catch any warning
104103
test.test_io.CTextIOWrapperTest('test_garbage_collection'), # AssertionError: filter ('', ResourceWarning) did not catch any warning
104+
test.test_io.PyMiscIOTest('test_io_after_close'), # AttributeError: 'FileIO' object has no attribute 'read1'
105105
test.test_io.PyMiscIOTest('test_pickling'), # AssertionError: TypeError not raised by _dumps
106106
]
107107
if sys.version_info >= (3, 6):
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Licensed to the .NET Foundation under one or more agreements.
2+
# The .NET Foundation licenses this file to you under the Apache 2.0 License.
3+
# See the LICENSE file in the project root for more information.
4+
5+
##
6+
## Run selected tests from test_regrtest from StdLib
7+
##
8+
9+
import sys
10+
11+
from iptest import is_ironpython, generate_suite, run_test
12+
13+
import test.test_regrtest
14+
15+
def load_tests(loader, standard_tests, pattern):
16+
tests = loader.loadTestsFromModule(test.test_regrtest, pattern=pattern)
17+
18+
if is_ironpython:
19+
failing_tests = []
20+
21+
skip_tests = []
22+
if sys.version_info >= (3, 6):
23+
skip_tests += [
24+
# TODO: these all fail (and are slow)
25+
test.test_regrtest.ArgsTestCase('test_coverage'),
26+
test.test_regrtest.ArgsTestCase('test_crashed'),
27+
test.test_regrtest.ArgsTestCase('test_env_changed'),
28+
test.test_regrtest.ArgsTestCase('test_failing_test'),
29+
test.test_regrtest.ArgsTestCase('test_forever'),
30+
test.test_regrtest.ArgsTestCase('test_fromfile'),
31+
test.test_regrtest.ArgsTestCase('test_huntrleaks'),
32+
test.test_regrtest.ArgsTestCase('test_huntrleaks_fd_leak'),
33+
test.test_regrtest.ArgsTestCase('test_interrupted'),
34+
test.test_regrtest.ArgsTestCase('test_list_cases'),
35+
test.test_regrtest.ArgsTestCase('test_list_tests'),
36+
test.test_regrtest.ArgsTestCase('test_matchfile'),
37+
test.test_regrtest.ArgsTestCase('test_no_test_ran_some_test_exist_some_not'),
38+
test.test_regrtest.ArgsTestCase('test_no_tests_ran'),
39+
test.test_regrtest.ArgsTestCase('test_no_tests_ran_multiple_tests_nonexistent'),
40+
test.test_regrtest.ArgsTestCase('test_random'),
41+
test.test_regrtest.ArgsTestCase('test_rerun_fail'),
42+
test.test_regrtest.ArgsTestCase('test_resources'),
43+
test.test_regrtest.ArgsTestCase('test_slow_interrupted'),
44+
test.test_regrtest.ArgsTestCase('test_slowest'),
45+
test.test_regrtest.ArgsTestCase('test_wait'),
46+
test.test_regrtest.ProgramsTestCase('test_module_autotest'),
47+
test.test_regrtest.ProgramsTestCase('test_module_from_test_autotest'),
48+
test.test_regrtest.ProgramsTestCase('test_module_regrtest'),
49+
test.test_regrtest.ProgramsTestCase('test_module_test'),
50+
test.test_regrtest.ProgramsTestCase('test_pcbuild_rt'),
51+
test.test_regrtest.ProgramsTestCase('test_script_autotest'),
52+
test.test_regrtest.ProgramsTestCase('test_script_regrtest'),
53+
test.test_regrtest.ProgramsTestCase('test_tools_buildbot_test'),
54+
test.test_regrtest.ProgramsTestCase('test_tools_script_run_tests'),
55+
]
56+
57+
return generate_suite(tests, failing_tests, skip_tests)
58+
59+
else:
60+
return tests
61+
62+
run_test(__name__)

0 commit comments

Comments
 (0)