Skip to content

Commit 23eaa97

Browse files
committed
Merge branch 'main' into 3.6
2 parents 03f385d + 3ca27bb commit 23eaa97

15 files changed

Lines changed: 58 additions & 47 deletions

File tree

src/core/IronPython/Compiler/Ast/FunctionDefinition.cs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -680,11 +680,12 @@ private LightLambdaExpression CreateFunctionLambda() {
680680
InitializeParameters(init, needsWrapperMethod, parameters);
681681

682682
List<MSAst.Expression> statements = new List<MSAst.Expression>();
683-
// add beginning sequence point
684-
var start = GlobalParent.IndexToLocation(StartIndex);
685-
statements.Add(GlobalParent.AddDebugInfo(
686-
AstUtils.Empty(),
687-
new SourceSpan(new SourceLocation(0, start.Line, start.Column), new SourceLocation(0, start.Line, int.MaxValue))));
683+
684+
// Add beginning sequence point. For async functions this body is deferred into the nested Async/AsyncEnumerable lambda,
685+
// and the outer factory (which runs first, and is the only one traced today) re-emits its own entry point at StartIndex;
686+
// anchor this one at HeaderIndex (end of the signature) so the two occupy distinct source locations should the deferred
687+
// body ever become traceable. For single-line signatures both still land on the same line (differing only in column).
688+
statements.Add(MakeFunctionEntrySequencePoint(IsAsync ? HeaderIndex : StartIndex));
688689

689690

690691
// For generators/coroutines, we need to do a check before the first statement for Generator.Throw() / Generator.Close().
@@ -739,6 +740,7 @@ private LightLambdaExpression CreateFunctionLambda() {
739740
var throwSlot = AsyncThrowSlot;
740741
body = MSAst.Expression.Block(
741742
[cts, excBox, sendSlot, throwSlot],
743+
MakeFunctionEntrySequencePoint(StartIndex),
742744
MSAst.Expression.Assign(cts, MSAst.Expression.New(typeof(CancellationTokenSource))),
743745
MSAst.Expression.Assign(excBox, MSAst.Expression.New(typeof(StrongBox<Exception>))),
744746
MSAst.Expression.Assign(sendSlot, MSAst.Expression.New(typeof(StrongBox<object>))),
@@ -758,6 +760,7 @@ private LightLambdaExpression CreateFunctionLambda() {
758760
// rather than whatever context happened to be current at construction.
759761
body = MSAst.Expression.Block(
760762
[cts, excBox],
763+
MakeFunctionEntrySequencePoint(StartIndex),
761764
MSAst.Expression.Assign(cts, MSAst.Expression.New(typeof(CancellationTokenSource))),
762765
MSAst.Expression.Assign(excBox, MSAst.Expression.New(typeof(StrongBox<Exception>))),
763766
Ast.Call(
@@ -805,6 +808,13 @@ private LightLambdaExpression CreateFunctionLambda() {
805808

806809
internal FunctionCode FunctionCode => GetOrMakeFunctionCode();
807810

811+
private MSAst.Expression MakeFunctionEntrySequencePoint(int index) {
812+
var loc = GlobalParent.IndexToLocation(index);
813+
return GlobalParent.AddDebugInfo(
814+
AstUtils.Empty(),
815+
new SourceSpan(new SourceLocation(0, loc.Line, loc.Column), new SourceLocation(0, loc.Line, int.MaxValue)));
816+
}
817+
808818
private static MSAst.Expression/*!*/ AddDefaultReturn(MSAst.Expression/*!*/ body, Type returnType) {
809819
if (body.Type == typeof(void) && returnType != typeof(void)) {
810820
body = Ast.Block(body, Ast.Default(returnType));

tests/IronPython.Tests/Cases/IronPythonCasesManifest.ini

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,6 @@ NotParallelSafe=true # Uses a temporary module with a fixed name
193193
[IronPython.modules.misc.test__weakref]
194194
RetryCount=2
195195

196-
[IronPython.modules.misc.test_zlib]
197-
NotParallelSafe=true # test_data.gz
198-
199196
[IronPython.modules.system_related.test_nt]
200197
RunCondition=NOT $(IS_POSIX)
201198
NotParallelSafe=true # Uses fixed file, directory, and environment variable names

tests/suite/interop/net/field/test_field_misc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ def test_accessibility(self):
2525
self.assertIn('ProtectedField', dir(o))
2626
with self.assertRaises(TypeError):
2727
hasattr(o, 'ProtectedField')
28-
self.assertRaisesRegexp(AttributeError, "'Misc' object has no attribute 'PrivateField'", lambda: o.PrivateField)
28+
self.assertRaisesRegex(AttributeError, "'Misc' object has no attribute 'PrivateField'", lambda: o.PrivateField)
2929
self.assertEqual(o.InterfaceField.PublicStaticField, 500)
30-
30+
3131
o = DerivedMisc()
3232
o.Set()
3333
self.assertEqual(o.PublicField, 400)

tests/suite/interop/net/type/test___clrtype.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ class X(object, metaclass=MyType):
529529
#Shouldn't be able to use non-UInt64s
530530
try:
531531
x.NOT_SO_DYNAMIC = "0"
532-
Fail("TypeError should have been thrown!")
532+
self.fail("TypeError should have been thrown!")
533533
except TypeError as e:
534534
self.assertEqual(str(e),
535535
"expected UInt64, got str")
@@ -710,7 +710,7 @@ def __clrtype__(self, stuff):
710710
try:
711711
class X(object, metaclass=MyType):
712712
pass
713-
Fail("Bad __clrtype__ signature!")
713+
self.fail("Bad __clrtype__ signature!")
714714

715715
except TypeError as e:
716716
self.assertEqual(str(e),
@@ -748,7 +748,7 @@ def __clrtype__(self):
748748
try:
749749
class X(object, metaclass=MyType):
750750
pass
751-
Fail("Arbitrary return values of __clrtype__ should not be allowed: " + str(x))
751+
self.fail("Arbitrary return values of __clrtype__ should not be allowed: " + str(x))
752752
except TypeError as e:
753753
self.assertEqual(str(e),
754754
expected_msg)
@@ -768,7 +768,7 @@ def __clrtype__(self):
768768
try:
769769
class X(object, metaclass=MyType):
770770
pass
771-
Fail("Arbitrary return values of __clrtype__ are not allowed: ", + str(x))
771+
self.fail("Arbitrary return values of __clrtype__ are not allowed: ", + str(x))
772772
except ValueError as e:
773773
self.assertEqual(str(e), "__clrtype__ must return a type, not None")
774774
finally:

tests/suite/modules/io_related/test_cPickle.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ def test_cp945(self):
718718
#--sanity
719719
try:
720720
x = 1/0
721-
Fail("should have been division by zero error")
721+
self.fail("should have been division by zero error")
722722
except Exception as e:
723723
ex = e
724724

tests/suite/modules/io_related/test_copyreg.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,11 +173,11 @@ def test_extension_cache(self):
173173
"The get and set of the attribute failed")
174174

175175
if 'cache1' not in copyreg._extension_cache or 'cache2' not in copyreg._extension_cache:
176-
Fail("Set of the attribute failed")
176+
self.fail("Set of the attribute failed")
177177

178178
copyreg.clear_extension_cache()
179179
if 'cache1' in copyreg._extension_cache or 'cache2' in copyreg._extension_cache:
180-
Fail("The method clear_extension_cache did not work correctly ")
180+
self.fail("The method clear_extension_cache did not work correctly ")
181181

182182
def test_reconstructor(self):
183183
reconstructor_copy = copyreg._reconstructor

tests/suite/modules/misc/test_operator.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import operator
66
import unittest
7+
import sys
78

89
from iptest import IronPythonTestCase, is_cli, is_netcoreapp, big, run_test, skipUnlessIronPython
910

@@ -276,7 +277,7 @@ def pow(a,b): return a ** b
276277
r = fnc(a,b)
277278
except:
278279
(exc_type, exc_value, exc_traceback) = sys.exc_info()
279-
Fail("Binary operator failed: %s, %s: %s %s %s (Message=%s)" % (type(a).__name__, type(b).__name__, str(a), sym, str(b), str(exc_value)))
280+
self.fail("Binary operator failed: %s, %s: %s %s %s (Message=%s)" % (type(a).__name__, type(b).__name__, str(a), sym, str(b), str(exc_value)))
280281

281282
threes = [ 3, big(3), 3.0 ]
282283
zeroes = [ 0, big(0), 0.0 ]
@@ -294,7 +295,7 @@ def pow(a,b): return a ** b
294295
pass
295296
else:
296297
(exc_type, exc_value, exc_traceback) = sys.exc_info()
297-
Fail("Didn't get ZeroDivisionError %s, %s, %s, %s, %s (Message=%s)" % (str(func), type(i).__name__, type(j).__name__, str(i), str(j), str(exc_value)))
298+
self.fail("Didn't get ZeroDivisionError %s, %s, %s, %s, %s (Message=%s)" % (str(func), type(i).__name__, type(j).__name__, str(i), str(j), str(exc_value)))
298299

299300
def test_unary_ops(self):
300301
if is_cli:

tests/suite/test_class.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2167,7 +2167,7 @@ def __getattr__(self, name): raise AttributeError('catch me')
21672167
y = x.throws
21682168
except AttributeError as ex:
21692169
self.assertEqual(ex.args, ('catch me',))
2170-
else: Fail("should have thrown")
2170+
else: self.fail("should have thrown")
21712171

21722172
def test_descriptor_meta_magic(self):
21732173
class valueDescriptor(object):

tests/suite/test_dict_stdlib.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,11 @@ def load_tests(loader, standard_tests, pattern):
3030
if is_mono:
3131
skip_tests += [
3232
test.test_dict.DictTest('test_container_iterator'), # https://github.com/IronLanguages/ironpython3/issues/544
33-
test.test_dict.DictTest('test_free_after_iterating') # AssertionError
3433
]
34+
if sys.version_info >= (3, 6):
35+
skip_tests += [
36+
test.test_dict.DictTest('test_free_after_iterating') # AssertionError
37+
]
3538

3639
return generate_suite(tests, failing_tests, skip_tests)
3740

tests/suite/test_metaclass.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ class D(C): pass
133133
class D(C1, metaclass=dash_attributes):
134134
pass
135135
except TypeError: pass
136-
else: Fail("metaclass conflict expected")
136+
else: self.fail("metaclass conflict expected")
137137

138138
class D(C2, metaclass=dash_attributes):
139139
def StartSomethingToday(self): pass

0 commit comments

Comments
 (0)