summaryrefslogtreecommitdiffstatshomepage
path: root/tests/basics/fun_code_micropython.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/basics/fun_code_micropython.py')
-rw-r--r--tests/basics/fun_code_micropython.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/basics/fun_code_micropython.py b/tests/basics/fun_code_micropython.py
new file mode 100644
index 0000000000..2c319a2db8
--- /dev/null
+++ b/tests/basics/fun_code_micropython.py
@@ -0,0 +1,19 @@
+# Test MicroPython-specific restrictions of function.__code__ attribute.
+
+try:
+ (lambda: 0).__code__
+except AttributeError:
+ print("SKIP")
+ raise SystemExit
+
+
+def f_with_children():
+ def g():
+ pass
+
+
+# Can't access __code__ when function has children.
+try:
+ f_with_children.__code__
+except AttributeError:
+ print("AttributeError")