From 14719f367c57b3523ea3d67bec0eeb4746e713d1 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Tue, 29 Jul 2025 12:03:08 -0600 Subject: [PATCH 1/4] fix: dir(concurrent.futures) and tab completion broken --- Lib/concurrent/futures/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/concurrent/futures/__init__.py b/Lib/concurrent/futures/__init__.py index e717222cf98b32..d6ac4b3e0b675f 100644 --- a/Lib/concurrent/futures/__init__.py +++ b/Lib/concurrent/futures/__init__.py @@ -44,7 +44,7 @@ def __dir__(): - return __all__ + ('__author__', '__doc__') + return __all__ + ['__author__', '__doc__'] def __getattr__(name): From 8c0858bfa5647000e2e09e21b2c7ac6d79ac5dfc Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Thu, 31 Jul 2025 10:32:16 -0400 Subject: [PATCH 2/4] docs: add news entry Signed-off-by: Henry Schreiner --- .../next/Library/2025-07-31-10-31-56.gh-issue-137282.GOCwIC.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Library/2025-07-31-10-31-56.gh-issue-137282.GOCwIC.rst diff --git a/Misc/NEWS.d/next/Library/2025-07-31-10-31-56.gh-issue-137282.GOCwIC.rst b/Misc/NEWS.d/next/Library/2025-07-31-10-31-56.gh-issue-137282.GOCwIC.rst new file mode 100644 index 00000000000000..8a5dcdf642ffb0 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2025-07-31-10-31-56.gh-issue-137282.GOCwIC.rst @@ -0,0 +1 @@ +Fixed tab completion / ``dir()`` on ``concurrent.futures``. From f2482cbaab46d012be3c0e3641ff285d99328645 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Thu, 31 Jul 2025 11:10:07 -0400 Subject: [PATCH 3/4] tests: add a __dir__ check to the __all__test Signed-off-by: Henry Schreiner --- Lib/test/test___all__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Lib/test/test___all__.py b/Lib/test/test___all__.py index f35b1194308262..851bc4724975d9 100644 --- a/Lib/test/test___all__.py +++ b/Lib/test/test___all__.py @@ -48,6 +48,7 @@ def check_all(self, modname): raise FailedImport(modname) if not hasattr(sys.modules[modname], "__all__"): raise NoAll(modname) + names = {} with self.subTest(module=modname): with warnings_helper.check_warnings( @@ -72,6 +73,9 @@ def check_all(self, modname): all_set = set(all_list) self.assertCountEqual(all_set, all_list, "in module {}".format(modname)) self.assertEqual(keys, all_set, "in module {}".format(modname)) + # Verify __dir__ is non-empty and doesn't produce an error + self.assertTrue(dir(sys.modules[modname])) + def walk_modules(self, basedir, modpath): for fn in sorted(os.listdir(basedir)): From d4f7d945e25064c7d73575e21e7e098e6aaf2af4 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Thu, 31 Jul 2025 11:22:46 -0400 Subject: [PATCH 4/4] Apply suggestions from code review Co-authored-by: Peter Bierma --- Lib/test/test___all__.py | 2 -- .../next/Library/2025-07-31-10-31-56.gh-issue-137282.GOCwIC.rst | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/Lib/test/test___all__.py b/Lib/test/test___all__.py index 851bc4724975d9..8ded9f99248372 100644 --- a/Lib/test/test___all__.py +++ b/Lib/test/test___all__.py @@ -48,7 +48,6 @@ def check_all(self, modname): raise FailedImport(modname) if not hasattr(sys.modules[modname], "__all__"): raise NoAll(modname) - names = {} with self.subTest(module=modname): with warnings_helper.check_warnings( @@ -76,7 +75,6 @@ def check_all(self, modname): # Verify __dir__ is non-empty and doesn't produce an error self.assertTrue(dir(sys.modules[modname])) - def walk_modules(self, basedir, modpath): for fn in sorted(os.listdir(basedir)): path = os.path.join(basedir, fn) diff --git a/Misc/NEWS.d/next/Library/2025-07-31-10-31-56.gh-issue-137282.GOCwIC.rst b/Misc/NEWS.d/next/Library/2025-07-31-10-31-56.gh-issue-137282.GOCwIC.rst index 8a5dcdf642ffb0..78f169ea029b17 100644 --- a/Misc/NEWS.d/next/Library/2025-07-31-10-31-56.gh-issue-137282.GOCwIC.rst +++ b/Misc/NEWS.d/next/Library/2025-07-31-10-31-56.gh-issue-137282.GOCwIC.rst @@ -1 +1 @@ -Fixed tab completion / ``dir()`` on ``concurrent.futures``. +Fix tab completion and :func:`dir` on :mod:`concurrent.futures`.