Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions tests/IronPython.Tests/Cases/CPythonCasesManifest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -744,10 +744,6 @@ Ignore=true
[CPython.test_resource]
RunCondition=$(IS_POSIX) # Module resource is Posix-specific

[CPython.test_robotparser]
Ignore=true
Reason=StackOverflowException - https://github.com/IronLanguages/ironpython2/issues/182

[CPython.test_runpy]
Ignore=true
Reason=NotImplementedError: sys.implementation.cache_tag is None
Expand Down Expand Up @@ -1031,10 +1027,6 @@ RunCondition=$(IS_WINDOWS)
[CPython.test_with]
Ignore=true

[CPython.test_wsgiref]
Ignore=true
Reason=StackOverflowException - https://github.com/IronLanguages/ironpython2/issues/182

[CPython.test_xml_etree]
Ignore=true

Expand Down
4 changes: 0 additions & 4 deletions tests/IronPython.Tests/Cases/IronPythonCasesManifest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,6 @@ Reason=Uses MAUI framework, which was MS internal?
Ignore=true
Reason=Unstable - https://github.com/IronLanguages/ironpython3/issues/1037

[IronPython.test_tcf]
Ignore=true
Reason=StackOverflowException - https://github.com/IronLanguages/ironpython2/issues/182

[IronPython.test_threadsafety]
Ignore=true

Expand Down
73 changes: 73 additions & 0 deletions tests/suite/test_regressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1757,4 +1757,77 @@ def test_ipy3_gh1977(self):
else:
self.assertTrue(isinstance(res, t))

@skipUnlessIronPython()
def test_ipy3_gh1182(self):
# https://github.com/IronLanguages/ironpython3/issues/1182
import System
from System.Diagnostics import StackTrace

# leaving an except or finally clause with a jump, or raising an exception from a finally clause that
# is handled in the same function, must not grow the CLR stack
def except_continue(n):
depths = []
for _ in range(n):
try:
int('x')
except ValueError:
depths.append(StackTrace().FrameCount)
continue
return depths

def except_break(n):
depths = []
for _ in range(n):
for _ in range(1):
try:
int('x')
except ValueError:
depths.append(StackTrace().FrameCount)
break
return depths

def finally_break(n):
depths = []
for _ in range(n):
for _ in range(1):
try:
int('x')
finally:
depths.append(StackTrace().FrameCount)
break
return depths

def finally_raise(n):
depths = []
for _ in range(n):
try:
try:
int('x')
finally:
depths.append(StackTrace().FrameCount)
raise KeyError()
except KeyError:
pass
return depths

for f in (except_continue, except_break, finally_break, finally_raise):
# fewer iterations than the default compilation threshold, so that the loops stay interpreted
depths = f(25)
# the stack grew by a frame per iteration; call sites being set up account for small differences
self.assertLess(depths[-1] - depths[5], 5, f.__name__)

# an exception rethrown by interpreted code keeps its .NET stack trace
def parse():
try:
System.Int32.Parse('x')
finally:
pass

def call():
parse()

with self.assertRaises(System.FormatException) as cm:
call()
self.assertTrue(any(name in cm.exception.StackTrace for name in ('Int32.Parse', 'ParseInt32')))

run_test(__name__)
Loading