diff options
| author | Mark Shannon <mark@hotpy.org> | 2020-01-13 12:51:26 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-01-13 12:51:26 +0000 |
| commit | e7c9f4aae1a8540fe8e9a8a5017b16f906f51068 (patch) | |
| tree | 30ad0ede1cb263c0882121a14c25f4e98b40bfe9 /Lib/test/test_code.py | |
| parent | 97f1267a5431db97bd6f88f996a35ea516581100 (diff) | |
| download | cpython-git-e7c9f4aae1a8540fe8e9a8a5017b16f906f51068.tar.gz | |
Cleanup exit code for interpreter. (GH-17756)
Diffstat (limited to 'Lib/test/test_code.py')
| -rw-r--r-- | Lib/test/test_code.py | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/Lib/test/test_code.py b/Lib/test/test_code.py index 656c46cfaa..7bb824ea31 100644 --- a/Lib/test/test_code.py +++ b/Lib/test/test_code.py @@ -434,42 +434,6 @@ if check_impl_detail(cpython=True) and ctypes is not None: tt.join() self.assertEqual(LAST_FREED, 500) - @cpython_only - def test_clean_stack_on_return(self): - - def f(x): - return x - - code = f.__code__ - ct = type(f.__code__) - - # Insert an extra LOAD_FAST, this duplicates the value of - # 'x' in the stack, leaking it if the frame is not properly - # cleaned up upon exit. - - bytecode = list(code.co_code) - bytecode.insert(-2, opcode.opmap['LOAD_FAST']) - bytecode.insert(-2, 0) - - c = ct(code.co_argcount, code.co_posonlyargcount, - code.co_kwonlyargcount, code.co_nlocals, code.co_stacksize+1, - code.co_flags, bytes(bytecode), - code.co_consts, code.co_names, code.co_varnames, - code.co_filename, code.co_name, code.co_firstlineno, - code.co_lnotab, code.co_freevars, code.co_cellvars) - new_function = type(f)(c, f.__globals__, 'nf', f.__defaults__, f.__closure__) - - class Var: - pass - the_object = Var() - var = weakref.ref(the_object) - - new_function(the_object) - - # Check if the_object is leaked - del the_object - assert var() is None - def test_main(verbose=None): from test import test_code |
