From 8bb84cc627b933ff3eb9931a97197e459811fe36 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Tue, 2 May 2017 03:42:46 +0300 Subject: [PATCH] tests/cpydiff/core_function_userattr: Clarify, fill in cause and workaround. --- tests/cpydiff/core_function_instancevar.py | 11 ----------- tests/cpydiff/core_function_userattr.py | 11 +++++++++++ 2 files changed, 11 insertions(+), 11 deletions(-) delete mode 100644 tests/cpydiff/core_function_instancevar.py create mode 100644 tests/cpydiff/core_function_userattr.py diff --git a/tests/cpydiff/core_function_instancevar.py b/tests/cpydiff/core_function_instancevar.py deleted file mode 100644 index ab027b1662..0000000000 --- a/tests/cpydiff/core_function_instancevar.py +++ /dev/null @@ -1,11 +0,0 @@ -""" -categories: Core,Functions -description: Assign instance variable to function -cause: Unknown -workaround: Unknown -""" -def f(): - pass - -f.x = 0 -print(f.x) diff --git a/tests/cpydiff/core_function_userattr.py b/tests/cpydiff/core_function_userattr.py new file mode 100644 index 0000000000..2972939084 --- /dev/null +++ b/tests/cpydiff/core_function_userattr.py @@ -0,0 +1,11 @@ +""" +categories: Core,Functions +description: User-defined attributes for functions are not supported +cause: MicroPython is highly optimized for memory usage. +workaround: Use external dictionary, e.g. ``FUNC_X[f] = 0``. +""" +def f(): + pass + +f.x = 0 +print(f.x)