Skip to content

Commit c309c62

Browse files
committed
Merge branch 'main' into 3.6
2 parents a911e41 + dc88645 commit c309c62

62 files changed

Lines changed: 977 additions & 508 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

make.ps1

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -244,18 +244,6 @@ function Purge() {
244244
}
245245

246246
switch -wildcard ($target) {
247-
# debug targets
248-
"restore-debug" { Main "RestoreReferences" "Debug" }
249-
"debug" { Main "Build" "Debug" }
250-
"clean-debug" { Main "Clean" "Debug" }
251-
"stage-debug" { Main "Stage" "Debug" }
252-
"package-debug" { Main "Package" "Debug" }
253-
"test-debug-*" { Test $target.Substring(11) "Debug" $frameworks $platform; break }
254-
"test-debug" { Test "all" "Debug" $frameworks $platform; break }
255-
256-
# release targets
257-
"release" { Main "Build" "Release" }
258-
259247
# general targets
260248
"restore" { Main "RestoreReferences" $configuration }
261249
"build" { Main "Build" $configuration }

src/core/IronPython.Modules/_signal.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@
2323

2424
#if FEATURE_PROCESS
2525

26+
#if PYTHON_34 // rename to _signal in 3.5
27+
[assembly: PythonModule("signal", typeof(IronPython.Modules.PythonSignal))]
28+
#else
2629
[assembly: PythonModule("_signal", typeof(IronPython.Modules.PythonSignal))]
30+
#endif
2731
namespace IronPython.Modules {
2832
public static partial class PythonSignal {
2933
public const string __doc__ = """

tests/IronPython.Tests/Cases/CPythonCasesManifest.ini

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,12 @@ Ignore=true
121121
Ignore=true
122122
Reason=ImportError: No module named audioop
123123

124-
[CPython.test_asdl_parser] # new in 3.5
124+
[CPython.test_array] # IronPython.test_array_stdlib
125125
Ignore=true
126-
Reason=unittest.case.SkipTest: test irrelevant for an installed Python
127126

128-
[CPython.test_array] # IronPython.test_array_stdlib
127+
[CPython.test_asdl_parser] # new in 3.5
129128
Ignore=true
129+
Reason=unittest.case.SkipTest: test irrelevant for an installed Python
130130

131131
[CPython.test_ast]
132132
Ignore=true
@@ -438,7 +438,7 @@ Ignore=true
438438
Ignore=true
439439
Reason=unittest.case.SkipTest: test works only on Linux 2.6
440440

441-
[CPython.test_exception_hierarchy] # used to be test_pep3151
441+
[CPython.test_exception_hierarchy] # used to be test_pep3151 (renamed in 3.6)
442442
Ignore=true
443443

444444
[CPython.test_exceptions]
@@ -531,8 +531,9 @@ Reason=Only valid for Unix
531531
[CPython.test_gzip]
532532
IsolationLevel=PROCESS # https://github.com/IronLanguages/ironpython3/issues/1440
533533

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

537538
[CPython.test_httplib] # IronPython.test_httplib_stdlib
538539
Ignore=true
@@ -603,8 +604,9 @@ Ignore=true
603604
[CPython.test_lib2to3]
604605
Ignore=true
605606

606-
[CPython.test_linecache]
607-
Ignore=true # blocked by https://github.com/IronLanguages/ironpython3/issues/1245 - using the test_linecache_stdlib approach makes the issue disappear...
607+
# TODO: 3.6
608+
#[CPython.test_linecache]
609+
#Ignore=true # blocked by https://github.com/IronLanguages/ironpython3/issues/1245 - using the test_linecache_stdlib approach makes the issue disappear...
608610

609611
[CPython.test_list]
610612
IsolationLevel=ENGINE
@@ -733,6 +735,20 @@ Reason=Blocking
733735
[CPython.test_peepholer]
734736
Ignore=true
735737

738+
[CPython.test_pep277] # renamed to test_unicode_file_functions in 3.6
739+
RunCondition=NOT $(IS_POSIX) # TODO: debug
740+
NotParallelSafe=true # Renames files to/from a static name 'tmp'
741+
742+
[CPython.test_pep380] # IronPython.test_yield_from_stdlib - renamed to test_yield_from in 3.6
743+
Ignore=true
744+
745+
[CPython.test_pep3131] # renamed to test_unicode_identifiers in 3.6
746+
Ignore=true
747+
Reason=SyntaxError: invalid syntax
748+
749+
[CPython.test_pep3151] # renamed to test_exception_hierarchy in 3.6
750+
Ignore=true
751+
736752
[CPython.test_pickle]
737753
Ignore=true
738754
Reason=StackOverflowException
@@ -817,9 +833,10 @@ RunCondition=$(IS_POSIX)
817833
Ignore=true
818834
Reason=unittest.case.SkipTest: No module named 'readline'
819835

836+
# TODO: 3.6
820837
[CPython.test_regrtest]
821838
IsolationLevel=PROCESS
822-
Ignore=true # lots of failures
839+
#Ignore=true # lots of failures
823840

824841
[CPython.test_reprlib]
825842
Ignore=true
@@ -1063,11 +1080,11 @@ Ignore=true
10631080
[CPython.test_unicode_file]
10641081
Ignore=true
10651082

1066-
[CPython.test_unicode_file_functions] # used to be test_pep277
1083+
[CPython.test_unicode_file_functions] # used to be test_pep277 (renamed in 3.6)
10671084
RunCondition=NOT $(IS_POSIX) # TODO: debug
10681085
NotParallelSafe=true # Renames files to/from a static name 'tmp'
10691086

1070-
[CPython.test_unicode_identifiers] # used to be test_pep3131
1087+
[CPython.test_unicode_identifiers] # used to be test_pep3131 (renamed in 3.6)
10711088
Ignore=true
10721089
Reason=SyntaxError: invalid syntax
10731090

@@ -1154,7 +1171,7 @@ Ignore=true
11541171
Ignore=true
11551172
Reason=StackOverflowException - https://github.com/IronLanguages/ironpython2/issues/182
11561173

1157-
[CPython.test_yield_from] # IronPython.test_yield_from_stdlib - used to be test_pep380
1174+
[CPython.test_yield_from] # IronPython.test_yield_from_stdlib - used to be test_pep380 (renamed in 3.6)
11581175
Ignore=true
11591176

11601177
[CPython.test_zipfile]

tests/IronPython.Tests/Cases/IronPythonCasesManifest.ini

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ Ignore=true
99
RunCondition='$(FRAMEWORK)' <> '.NETFramework,Version=v4.6.2'
1010
Reason=Requires IAsyncEnumerable & IAsyncDisposable
1111

12-
[IronPython.test_base64_stdlib]
13-
IsolationLevel=PROCESS # https://github.com/IronLanguages/ironpython3/issues/1440
14-
1512
[IronPython.test_builtin_stdlib]
1613
RunCondition=NOT $(IS_MONO)
1714
Reason=Exception on adding DocTestSuite

tests/IronPython.Tests/Stress/Engine.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ private static long GetTotalMemory() {
4242
}
4343

4444
#if FEATURE_REFEMIT
45-
//[Test] // https://github.com/IronLanguages/ironpython3/issues/1444
45+
#if !PYTHON_36 // TODO: figure out
46+
[Test]
47+
#endif
4648
public void ScenarioXGC() {
4749
Assert.AreEqual(1, 1); // prevents nunit from counting towards memory usage
4850

tests/suite/gen_stdlib_test.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
## Run selected tests from {name} from StdLib
2323
##
2424
25+
import sys
26+
2527
from iptest import is_ironpython, generate_suite, run_test
2628
2729
import {package}test.{name}

tests/suite/modules/io_related/test_re.py

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

55
import re
6+
import sys
67
import unittest
78

89
from iptest import IronPythonTestCase, is_cli, run_test
@@ -33,6 +34,14 @@ def test_sanity_re(self):
3334
'''
3435
#compile
3536
self.assertTrue(hasattr(re.compile("(abc){1}"), "pattern"))
37+
if sys.version_info >= (3, 6):
38+
with self.assertRaises(ValueError): # cannot use LOCALE flag with a str pattern
39+
re.compile("(abc){1}", re.L)
40+
with self.assertRaises(ValueError): # cannot use LOCALE flag with a str pattern
41+
re.compile("(abc){1}", flags=re.L)
42+
else:
43+
self.assertTrue(hasattr(re.compile("(abc){1}", re.L), "pattern"))
44+
self.assertTrue(hasattr(re.compile("(abc){1}", flags=re.L), "pattern"))
3645
self.assertTrue(hasattr(re.compile(b"(abc){1}", re.L), "pattern"))
3746
self.assertTrue(hasattr(re.compile(b"(abc){1}", flags=re.L), "pattern"))
3847

@@ -50,13 +59,29 @@ def test_sanity_re(self):
5059
#search
5160
self.assertEqual(re.search("(abc){1}", ""), None)
5261
self.assertEqual(re.search("(abc){1}", "abcxyz").span(), (0,3))
62+
if sys.version_info >= (3, 6):
63+
with self.assertRaises(ValueError): # cannot use LOCALE flag with a str pattern
64+
re.search("(abc){1}", "abcxyz", re.L)
65+
with self.assertRaises(ValueError): # cannot use LOCALE flag with a str pattern
66+
re.search("(abc){1}", "abcxyz", flags=re.L)
67+
else:
68+
self.assertEqual(re.search("(abc){1}", "abcxyz", re.L).span(), (0,3))
69+
self.assertEqual(re.search("(abc){1}", "abcxyz", flags=re.L).span(), (0,3))
5370
self.assertEqual(re.search(b"(abc){1}", b"abcxyz", re.L).span(), (0,3))
5471
self.assertEqual(re.search(b"(abc){1}", b"abcxyz", flags=re.L).span(), (0,3))
5572
self.assertEqual(re.search("(abc){1}", "xyzabc").span(), (3,6))
5673

5774
#match
5875
self.assertEqual(re.match("(abc){1}", ""), None)
5976
self.assertEqual(re.match("(abc){1}", "abcxyz").span(), (0,3))
77+
if sys.version_info >= (3, 6):
78+
with self.assertRaises(ValueError): # cannot use LOCALE flag with a str pattern
79+
re.match("(abc){1}", "abcxyz", re.L)
80+
with self.assertRaises(ValueError): # cannot use LOCALE flag with a str pattern
81+
re.match("(abc){1}", "abcxyz", flags=re.L)
82+
else:
83+
self.assertEqual(re.match("(abc){1}", "abcxyz", re.L).span(), (0,3))
84+
self.assertEqual(re.match("(abc){1}", "abcxyz", flags=re.L).span(), (0,3))
6085
self.assertEqual(re.match(b"(abc){1}", b"abcxyz", re.L).span(), (0,3))
6186
self.assertEqual(re.match(b"(abc){1}", b"abcxyz", flags=re.L).span(), (0,3))
6287

@@ -76,13 +101,29 @@ def test_sanity_re(self):
76101
#findall
77102
self.assertEqual(re.findall("(abc){1}", ""), [])
78103
self.assertEqual(re.findall("(abc){1}", "abcxyz"), ['abc'])
104+
if sys.version_info >= (3, 6):
105+
with self.assertRaises(ValueError): # cannot use LOCALE flag with a str pattern
106+
re.findall("(abc){1}", "abcxyz", re.L)
107+
with self.assertRaises(ValueError): # cannot use LOCALE flag with a str pattern
108+
re.findall("(abc){1}", "abcxyz", flags=re.L)
109+
else:
110+
self.assertEqual(re.findall("(abc){1}", "abcxyz", re.L), ['abc'])
111+
self.assertEqual(re.findall("(abc){1}", "abcxyz", flags=re.L), ['abc'])
79112
self.assertEqual(re.findall(b"(abc){1}", b"abcxyz", re.L), [b'abc'])
80113
self.assertEqual(re.findall(b"(abc){1}", b"abcxyz", flags=re.L), [b'abc'])
81114
self.assertEqual(re.findall("(abc){1}", "xyzabcabc"), ['abc', 'abc'])
82115

83116
#finditer
84117
self.assertEqual([x.group() for x in re.finditer("(abc){1}", "")], [])
85118
self.assertEqual([x.group() for x in re.finditer("(abc){1}", "abcxyz")], ['abc'])
119+
if sys.version_info >= (3, 6):
120+
with self.assertRaises(ValueError): # cannot use LOCALE flag with a str pattern
121+
re.finditer("(abc){1}", "abcxyz", re.L)
122+
with self.assertRaises(ValueError): # cannot use LOCALE flag with a str pattern
123+
re.finditer("(abc){1}", "abcxyz", flags=re.L)
124+
else:
125+
self.assertEqual([x.group() for x in re.finditer("(abc){1}", "abcxyz", re.L)], ['abc'])
126+
self.assertEqual([x.group() for x in re.finditer("(abc){1}", "abcxyz", flags=re.L)], ['abc'])
86127
self.assertEqual([x.group() for x in re.finditer(b"(abc){1}", b"abcxyz", re.L)], [b'abc'])
87128
self.assertEqual([x.group() for x in re.finditer(b"(abc){1}", b"abcxyz", flags=re.L)], [b'abc'])
88129
self.assertEqual([x.group() for x in re.finditer("(abc){1}", "xyzabcabc")], ['abc', 'abc'])
@@ -188,6 +229,11 @@ def test_sanity_re_pattern(self):
188229

189230
#flags
190231
self.assertEqual(pattern.flags, re.U)
232+
if sys.version_info >= (3, 6):
233+
with self.assertRaises(ValueError): # cannot use LOCALE flag with a str pattern
234+
re.compile("(abc){1}", re.L)
235+
else:
236+
self.assertEqual(re.compile("(abc){1}", re.L).flags, re.L | re.U)
191237
self.assertEqual(re.compile(b"(abc){1}", re.L).flags, re.L)
192238

193239
#groupindex
@@ -514,14 +560,24 @@ def test_bug858(self):
514560

515561
def test_finditer(self):
516562
# finditer
517-
matches = re.finditer("baz","barbazbarbazbar")
563+
matches = re.finditer("baz", "barbazbarbazbar")
518564
num = 0
519565
for m in matches:
520566
num = num + 1
521567
self.assertEqual("baz", m.group(0))
522568
self.assertTrue(num == 2)
523569

524-
matches = re.finditer(b"baz",b"barbazbarbazbar", re.L)
570+
if sys.version_info >= (3, 6):
571+
with self.assertRaises(ValueError): # cannot use LOCALE flag with a str pattern
572+
re.finditer("baz", "barbazbarbazbar", re.L)
573+
else:
574+
matches = re.finditer("baz", "barbazbarbazbar", re.L)
575+
num = 0
576+
for m in matches:
577+
num = num + 1
578+
self.assertEqual("baz", m.group(0))
579+
self.assertTrue(num == 2)
580+
matches = re.finditer(b"baz", b"barbazbarbazbar", re.L)
525581
num = 0
526582
for m in matches:
527583
num = num + 1
@@ -623,11 +679,14 @@ def test_groups(self):
623679

624680
def test_locale_flags(self):
625681
self.assertEqual(re.compile(r"^\#[ \t]*(\w[\d\w]*)[ \t](.*)").flags, re.U)
626-
with self.assertRaises(ValueError): # cannot use LOCALE flag with a str pattern
682+
if sys.version_info >= (3, 6):
683+
with self.assertRaises(ValueError): # cannot use LOCALE flag with a str pattern
684+
re.compile(r"^\#[ \t]*(\w[\d\w]*)[ \t](.*)", re.L)
685+
with self.assertRaises(ValueError): # cannot use LOCALE flag with a str pattern
686+
re.compile(r"(?L)^\#[ \t]*(\w[\d\w]*)[ \t](.*)")
687+
else:
627688
self.assertEqual(re.compile(r"^\#[ \t]*(\w[\d\w]*)[ \t](.*)", re.L).flags, re.L | re.U)
628-
with self.assertRaises(ValueError): # cannot use LOCALE flag with a str pattern
629689
self.assertEqual(re.compile(r"(?L)^\#[ \t]*(\w[\d\w]*)[ \t](.*)").flags, re.L | re.U)
630-
631690
self.assertEqual(re.compile(rb"", re.L).flags, re.L)
632691
self.assertEqual(re.compile(rb"(?L)").flags, re.L)
633692

@@ -797,7 +856,10 @@ def test_cp35146(self):
797856
def test_cp35135(self):
798857
self.assertEqual(re.match(r"(?iu)aA", "aa").string, "aa")
799858
self.assertEqual(re.match(r"(?iu)Aa", "aa").string, "aa")
800-
with self.assertRaises(ValueError): # cannot use LOCALE flag with a str pattern
859+
if sys.version_info >= (3, 6):
860+
with self.assertRaises(ValueError): # cannot use LOCALE flag with a str pattern
861+
self.assertEqual(re.match(r"(?iLmsux)Aa", "aa").string, "aa")
862+
else:
801863
self.assertEqual(re.match(r"(?iLmsux)Aa", "aa").string, "aa")
802864
self.assertEqual(re.match(r"(?imsux)Aa", "aa").string, "aa")
803865

tests/suite/modules/misc/test_datetime.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import datetime
1010
import os
11-
import unittest
11+
import sys
1212

1313
from iptest import IronPythonTestCase, is_cli, run_test, skipUnlessIronPython
1414

@@ -985,7 +985,10 @@ def test_time(self):
985985
#bool
986986
self.assertTrue(datetime.time(0, 0, 0, 1))
987987
#CodePlex Work Item 5139
988-
self.assertFalse(not (datetime.time(0, 0, 0, 0))) # __bool__ removed in 3.5
988+
if sys.version_info >= (3, 5):
989+
self.assertFalse(not (datetime.time(0, 0, 0, 0))) # __bool__ removed in 3.5
990+
else:
991+
self.assertTrue(not (datetime.time(0, 0, 0, 0)))
989992

990993
#replace
991994
x = datetime.time(1, 2, 33, 444)

tests/suite/modules/system_related/test_resource_stdlib.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
## Run selected tests from test_resource from StdLib
77
##
88

9+
import sys
10+
911
from iptest import is_ironpython, generate_suite, run_test
1012

1113
import test.test_resource

tests/suite/test_abc_stdlib.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
## Run selected tests from test_abc from StdLib
77
##
88

9+
import sys
10+
911
from iptest import is_ironpython, generate_suite, run_test
1012

1113
import test.test_abc
@@ -14,11 +16,15 @@ def load_tests(loader, standard_tests, pattern):
1416
tests = loader.loadTestsFromModule(test.test_abc, pattern=pattern)
1517

1618
if is_ironpython:
17-
failing_tests = [
18-
test.test_abc.TestABCWithInitSubclass('test_works_with_init_subclass'), # https://github.com/IronLanguages/ironpython3/issues/1448
19-
]
19+
failing_tests = []
20+
if sys.version_info >= (3, 6):
21+
failing_tests += [
22+
test.test_abc.TestABCWithInitSubclass('test_works_with_init_subclass'), # https://github.com/IronLanguages/ironpython3/issues/1448
23+
]
24+
25+
skip_tests = []
2026

21-
return generate_suite(tests, failing_tests)
27+
return generate_suite(tests, failing_tests, skip_tests)
2228

2329
else:
2430
return tests

0 commit comments

Comments
 (0)