forked from Rust-related/RustPython
Merge pull request #4554 from howjmay/co_stacksize
Add co_stacksize to code objects
This commit is contained in:
48
Lib/test/test_compile.py
vendored
48
Lib/test/test_compile.py
vendored
@@ -849,8 +849,6 @@ class TestStackSizeStability(unittest.TestCase):
|
||||
self.fail("stack sizes diverge with # of consecutive snippets: "
|
||||
"%s\n%s\n%s" % (sizes, snippet, out.getvalue()))
|
||||
|
||||
# TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure
|
||||
def test_if(self):
|
||||
snippet = """
|
||||
if x:
|
||||
@@ -858,8 +856,6 @@ class TestStackSizeStability(unittest.TestCase):
|
||||
"""
|
||||
self.check_stack_size(snippet)
|
||||
|
||||
# TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure
|
||||
def test_if_else(self):
|
||||
snippet = """
|
||||
if x:
|
||||
@@ -871,8 +867,6 @@ class TestStackSizeStability(unittest.TestCase):
|
||||
"""
|
||||
self.check_stack_size(snippet)
|
||||
|
||||
# TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure
|
||||
def test_try_except_bare(self):
|
||||
snippet = """
|
||||
try:
|
||||
@@ -882,8 +876,6 @@ class TestStackSizeStability(unittest.TestCase):
|
||||
"""
|
||||
self.check_stack_size(snippet)
|
||||
|
||||
# TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure
|
||||
def test_try_except_qualified(self):
|
||||
snippet = """
|
||||
try:
|
||||
@@ -897,8 +889,6 @@ class TestStackSizeStability(unittest.TestCase):
|
||||
"""
|
||||
self.check_stack_size(snippet)
|
||||
|
||||
# TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure
|
||||
def test_try_except_as(self):
|
||||
snippet = """
|
||||
try:
|
||||
@@ -912,8 +902,6 @@ class TestStackSizeStability(unittest.TestCase):
|
||||
"""
|
||||
self.check_stack_size(snippet)
|
||||
|
||||
# TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure
|
||||
def test_try_finally(self):
|
||||
snippet = """
|
||||
try:
|
||||
@@ -923,8 +911,6 @@ class TestStackSizeStability(unittest.TestCase):
|
||||
"""
|
||||
self.check_stack_size(snippet)
|
||||
|
||||
# TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure
|
||||
def test_with(self):
|
||||
snippet = """
|
||||
with x as y:
|
||||
@@ -932,8 +918,6 @@ class TestStackSizeStability(unittest.TestCase):
|
||||
"""
|
||||
self.check_stack_size(snippet)
|
||||
|
||||
# TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure
|
||||
def test_while_else(self):
|
||||
snippet = """
|
||||
while x:
|
||||
@@ -943,8 +927,6 @@ class TestStackSizeStability(unittest.TestCase):
|
||||
"""
|
||||
self.check_stack_size(snippet)
|
||||
|
||||
# TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure
|
||||
def test_for(self):
|
||||
snippet = """
|
||||
for x in y:
|
||||
@@ -952,8 +934,6 @@ class TestStackSizeStability(unittest.TestCase):
|
||||
"""
|
||||
self.check_stack_size(snippet)
|
||||
|
||||
# TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure
|
||||
def test_for_else(self):
|
||||
snippet = """
|
||||
for x in y:
|
||||
@@ -963,8 +943,6 @@ class TestStackSizeStability(unittest.TestCase):
|
||||
"""
|
||||
self.check_stack_size(snippet)
|
||||
|
||||
# TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure
|
||||
def test_for_break_continue(self):
|
||||
snippet = """
|
||||
for x in y:
|
||||
@@ -979,8 +957,6 @@ class TestStackSizeStability(unittest.TestCase):
|
||||
"""
|
||||
self.check_stack_size(snippet)
|
||||
|
||||
# TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure
|
||||
def test_for_break_continue_inside_try_finally_block(self):
|
||||
snippet = """
|
||||
for x in y:
|
||||
@@ -998,8 +974,6 @@ class TestStackSizeStability(unittest.TestCase):
|
||||
"""
|
||||
self.check_stack_size(snippet)
|
||||
|
||||
# TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure
|
||||
def test_for_break_continue_inside_finally_block(self):
|
||||
snippet = """
|
||||
for x in y:
|
||||
@@ -1017,8 +991,6 @@ class TestStackSizeStability(unittest.TestCase):
|
||||
"""
|
||||
self.check_stack_size(snippet)
|
||||
|
||||
# TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure
|
||||
def test_for_break_continue_inside_except_block(self):
|
||||
snippet = """
|
||||
for x in y:
|
||||
@@ -1036,8 +1008,6 @@ class TestStackSizeStability(unittest.TestCase):
|
||||
"""
|
||||
self.check_stack_size(snippet)
|
||||
|
||||
# TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure
|
||||
def test_for_break_continue_inside_with_block(self):
|
||||
snippet = """
|
||||
for x in y:
|
||||
@@ -1053,8 +1023,6 @@ class TestStackSizeStability(unittest.TestCase):
|
||||
"""
|
||||
self.check_stack_size(snippet)
|
||||
|
||||
# TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure
|
||||
def test_return_inside_try_finally_block(self):
|
||||
snippet = """
|
||||
try:
|
||||
@@ -1067,8 +1035,6 @@ class TestStackSizeStability(unittest.TestCase):
|
||||
"""
|
||||
self.check_stack_size(snippet)
|
||||
|
||||
# TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure
|
||||
def test_return_inside_finally_block(self):
|
||||
snippet = """
|
||||
try:
|
||||
@@ -1081,8 +1047,6 @@ class TestStackSizeStability(unittest.TestCase):
|
||||
"""
|
||||
self.check_stack_size(snippet)
|
||||
|
||||
# TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure
|
||||
def test_return_inside_except_block(self):
|
||||
snippet = """
|
||||
try:
|
||||
@@ -1095,8 +1059,6 @@ class TestStackSizeStability(unittest.TestCase):
|
||||
"""
|
||||
self.check_stack_size(snippet)
|
||||
|
||||
# TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure
|
||||
def test_return_inside_with_block(self):
|
||||
snippet = """
|
||||
with c:
|
||||
@@ -1107,8 +1069,6 @@ class TestStackSizeStability(unittest.TestCase):
|
||||
"""
|
||||
self.check_stack_size(snippet)
|
||||
|
||||
# TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure
|
||||
def test_async_with(self):
|
||||
snippet = """
|
||||
async with x as y:
|
||||
@@ -1116,8 +1076,6 @@ class TestStackSizeStability(unittest.TestCase):
|
||||
"""
|
||||
self.check_stack_size(snippet, async_=True)
|
||||
|
||||
# TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure
|
||||
def test_async_for(self):
|
||||
snippet = """
|
||||
async for x in y:
|
||||
@@ -1125,8 +1083,6 @@ class TestStackSizeStability(unittest.TestCase):
|
||||
"""
|
||||
self.check_stack_size(snippet, async_=True)
|
||||
|
||||
# TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure
|
||||
def test_async_for_else(self):
|
||||
snippet = """
|
||||
async for x in y:
|
||||
@@ -1136,8 +1092,6 @@ class TestStackSizeStability(unittest.TestCase):
|
||||
"""
|
||||
self.check_stack_size(snippet, async_=True)
|
||||
|
||||
# TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure
|
||||
def test_for_break_continue_inside_async_with_block(self):
|
||||
snippet = """
|
||||
for x in y:
|
||||
@@ -1153,8 +1107,6 @@ class TestStackSizeStability(unittest.TestCase):
|
||||
"""
|
||||
self.check_stack_size(snippet, async_=True)
|
||||
|
||||
# TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure
|
||||
def test_return_inside_async_with_block(self):
|
||||
snippet = """
|
||||
async with c:
|
||||
|
||||
@@ -247,6 +247,11 @@ impl PyRef<PyCode> {
|
||||
self.code.arg_count as usize
|
||||
}
|
||||
|
||||
#[pygetset]
|
||||
fn co_stacksize(self) -> u32 {
|
||||
self.code.max_stackdepth
|
||||
}
|
||||
|
||||
#[pygetset]
|
||||
pub fn co_filename(self) -> PyStrRef {
|
||||
self.code.source_path.to_owned()
|
||||
|
||||
Reference in New Issue
Block a user