From: Henry Schreiner Date: Thu, 31 Jul 2025 16:17:27 +0000 (-0400) Subject: gh-137282: Fix `TypeError` in tab completion and `dir()` of `concurrent.futures`... X-Git-Tag: v3.15.0a1~808 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2a87af062b79d914ce0120f1f1763213c1ebe8c4;p=thirdparty%2FPython%2Fcpython.git gh-137282: Fix `TypeError` in tab completion and `dir()` of `concurrent.futures` (GH-137214) Signed-off-by: Henry Schreiner --- diff --git a/Lib/concurrent/futures/__init__.py b/Lib/concurrent/futures/__init__.py index e717222cf98b..d6ac4b3e0b67 100644 --- a/Lib/concurrent/futures/__init__.py +++ b/Lib/concurrent/futures/__init__.py @@ -44,7 +44,7 @@ if _interpreters: def __dir__(): - return __all__ + ('__author__', '__doc__') + return __all__ + ['__author__', '__doc__'] def __getattr__(name): diff --git a/Lib/test/test___all__.py b/Lib/test/test___all__.py index f35b11943082..8ded9f992483 100644 --- a/Lib/test/test___all__.py +++ b/Lib/test/test___all__.py @@ -72,6 +72,8 @@ class AllTest(unittest.TestCase): 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)): 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 000000000000..78f169ea029b --- /dev/null +++ b/Misc/NEWS.d/next/Library/2025-07-31-10-31-56.gh-issue-137282.GOCwIC.rst @@ -0,0 +1 @@ +Fix tab completion and :func:`dir` on :mod:`concurrent.futures`.