]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-137282: Fix `TypeError` in tab completion and `dir()` of `concurrent.futures`...
authorHenry Schreiner <HenrySchreinerIII@gmail.com>
Thu, 31 Jul 2025 16:17:27 +0000 (12:17 -0400)
committerGitHub <noreply@github.com>
Thu, 31 Jul 2025 16:17:27 +0000 (16:17 +0000)
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Lib/concurrent/futures/__init__.py
Lib/test/test___all__.py
Misc/NEWS.d/next/Library/2025-07-31-10-31-56.gh-issue-137282.GOCwIC.rst [new file with mode: 0644]

index e717222cf98b324afc0a4b9edc99173c9ec8e745..d6ac4b3e0b675f60cfdaa949ddba883a160298c8 100644 (file)
@@ -44,7 +44,7 @@ if _interpreters:
 
 
 def __dir__():
-    return __all__ + ('__author__', '__doc__')
+    return __all__ + ['__author__', '__doc__']
 
 
 def __getattr__(name):
index f35b1194308262257db23556788b13c2aab03dfc..8ded9f99248372a9bf17e3e2e86a9cf02d19670e 100644 (file)
@@ -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 (file)
index 0000000..78f169e
--- /dev/null
@@ -0,0 +1 @@
+Fix tab completion and :func:`dir` on :mod:`concurrent.futures`.