diff options
author | Damien George <damien.p.george@gmail.com> | 2018-05-10 23:10:46 +1000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2018-05-10 23:14:23 +1000 |
commit | 3678a6bdc6a925f2bce6423c41f911229836f946 (patch) | |
tree | 954bd10aefdaf95a238a7a8b6d11cf46dfee542d /py/makeqstrdata.py | |
parent | 29d28c2574d6c0b93fd3fc869b389a61dee12102 (diff) |
py/modbuiltins: Make built-in dir support the __dir__ special method.
If MICROPY_PY_ALL_SPECIAL_METHODS is enabled then dir() will now delegate
to the special method __dir__ if the object it is listing has this method.
Diffstat (limited to 'py/makeqstrdata.py')
-rw-r--r-- | py/makeqstrdata.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/py/makeqstrdata.py b/py/makeqstrdata.py index 38fde1a9c..3c0a60909 100644 --- a/py/makeqstrdata.py +++ b/py/makeqstrdata.py @@ -114,6 +114,9 @@ def parse_input_headers(infiles): if ident == "": # Sort empty qstr above all still order = -200000 + elif ident == "__dir__": + # Put __dir__ after empty qstr for builtin dir() to work + order = -190000 elif ident.startswith("__"): order -= 100000 qstrs[ident] = (order, ident, qstr) |