summaryrefslogtreecommitdiffstatshomepage
path: root/tests/basics/fun_name.py
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2018-12-06 18:02:41 +1100
committerDamien George <damien.p.george@gmail.com>2018-12-06 18:02:41 +1100
commit113f00a9ab469a83d1004dac502077af0a8f4847 (patch)
treef3a56db2ea5fbd90fc41e94c9d0488d2feb632b2 /tests/basics/fun_name.py
parentda7355e213eb06cd82ec48548e8180e71f750603 (diff)
downloadmicropython-113f00a9ab469a83d1004dac502077af0a8f4847.tar.gz
micropython-113f00a9ab469a83d1004dac502077af0a8f4847.zip
py/objboundmeth: Support loading generic attrs from the method.
Instead of assuming that the method is a bytecode object, and only supporting load of __name__, make the operation generic by delegating the load to the method object itself. Saves a bit of code size and fixes the case of attempting to load __name__ on a native method, see issue #4028.
Diffstat (limited to 'tests/basics/fun_name.py')
-rw-r--r--tests/basics/fun_name.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/basics/fun_name.py b/tests/basics/fun_name.py
index a724f41118..53ca935616 100644
--- a/tests/basics/fun_name.py
+++ b/tests/basics/fun_name.py
@@ -15,3 +15,10 @@ try:
except AttributeError:
print('SKIP')
raise SystemExit
+
+# __name__ of a bound native method is not implemented in uPy
+# the test here is to make sure it doesn't crash
+try:
+ str((1).to_bytes.__name__)
+except AttributeError:
+ pass