From b0e5675cb6d601e41dd6892db4eee9ae7da26851 Mon Sep 17 00:00:00 2001 From: James Webber Date: Thu, 29 Jul 2021 13:11:01 -0400 Subject: [PATCH] allow rustpython to move things --- extra_tests/not_impl_gen.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/extra_tests/not_impl_gen.py b/extra_tests/not_impl_gen.py index 2cb8680044b..41f8f97983d 100644 --- a/extra_tests/not_impl_gen.py +++ b/extra_tests/not_impl_gen.py @@ -172,7 +172,7 @@ def onerror(modname): return list(modules.keys()) -def dir_of_mod_or_error(module_name): +def dir_of_mod_or_error(module_name, keep_other=True): # Importing modules causes ('Constant String', 2, None, 4) and # "Hello world!" to be printed to stdout. f = io.StringIO() @@ -189,7 +189,7 @@ def dir_of_mod_or_error(module_name): item = getattr(module, item_name) item_mod = inspect.getmodule(item) # don't repeat items imported from other modules - if item_mod is module or item_mod is None: + if keep_other or item_mod is module or item_mod is None: result[item_name] = extra_info(item) return result @@ -201,7 +201,8 @@ def gen_modules(): for mod_name in scan_modules(): if mod_name in ("this", "antigravity") or mod_name in PEP_594_MODULES: continue - dir_result = dir_of_mod_or_error(mod_name) + # when generating CPython list, ignore items defined by other modules + dir_result = dir_of_mod_or_error(mod_name, keep_other=False) if isinstance(dir_result, Exception): print( f"!!! {mod_name} skipped because {type(dir_result).__name__}: {str(dir_result)}",