summaryrefslogtreecommitdiff
path: root/tests/cmdline/cmd_showbc.py
diff options
context:
space:
mode:
authorPetr Viktorin <encukou@gmail.com>2019-09-20 09:16:34 +0200
committerDamien George <damien.p.george@gmail.com>2019-10-04 16:46:47 +1000
commit25a9bccdee2fe830046c1c1a0220ca7706597202 (patch)
tree69e2b808f5f523964dd4d71257dc4e9e60f309c4 /tests/cmdline/cmd_showbc.py
parent26e90a051415629796efbec59f1d653b46e43aea (diff)
py/compile: Disallow 'import *' outside module level.
This check follows CPython's behaviour, because 'import *' always populates the globals with the imported names, not locals. Since it's safe to do this (doesn't lead to a crash or undefined behaviour) the check is only enabled for MICROPY_CPYTHON_COMPAT. Fixes issue #5121.
Diffstat (limited to 'tests/cmdline/cmd_showbc.py')
-rw-r--r--tests/cmdline/cmd_showbc.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/cmdline/cmd_showbc.py b/tests/cmdline/cmd_showbc.py
index 916228356..f30b39ee1 100644
--- a/tests/cmdline/cmd_showbc.py
+++ b/tests/cmdline/cmd_showbc.py
@@ -115,7 +115,7 @@ def f():
# import
import a
from a import b
- from a import *
+ #from sys import * # tested at module scope
# raise
raise
@@ -154,3 +154,6 @@ del Class
# load super method
def f(self):
super().f()
+
+# import * (needs to be in module scope)
+from sys import *