Skip to content

Commit a47b328

Browse files
authored
Merge pull request #6417 from ShaharNaveh/regr-test-doc-leak
Add regression test for #4505
1 parent 35f8860 commit a47b328

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

extra_tests/snippets/builtin_type.py

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import types
2-
from testutils import assert_raises
32

3+
from testutils import assert_raises
44

55
# Spec: https://docs.python.org/2/library/types.html
66
print(None)
@@ -111,8 +111,6 @@ class D:
111111
with assert_raises(TypeError):
112112
del int.__qualname__
113113

114-
from testutils import assert_raises
115-
116114
import platform
117115

118116
if platform.python_implementation() == "RustPython":
@@ -607,3 +605,24 @@ class A(type):
607605

608606

609607
assert "__dict__" not in A.__dict__
608+
609+
610+
# regression tests for: https://github.com/RustPython/RustPython/issues/4505
611+
612+
613+
def foo():
614+
def inner():
615+
pass
616+
617+
618+
assert foo.__code__.co_names == ()
619+
620+
stmts = """
621+
import blah
622+
623+
def foo():
624+
pass
625+
"""
626+
627+
code = compile(stmts, "<test>", "exec")
628+
assert code.co_names == ("blah", "foo")

0 commit comments

Comments
 (0)