Skip to content

fix: dir(concurrent.futures) and tab completion broken #137214

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

henryiii
Copy link
Contributor

@henryiii henryiii commented Jul 29, 2025

I just noticed that in 3.14rc1, tab completion is broken on concurrent.futures. Trying dir, I got:

>>> import concurrent.futures
>>> dir(concurrent.futures)
Traceback (most recent call last):
  File "<python-input-2>", line 1, in <module>
    dir(concurrent.futures)
    ~~~^^^^^^^^^^^^^^^^^^^^
  File "/Users/henryschreiner/.local/share/uv/python/cpython-3.14.0rc1+freethreaded-macos-x86_64-none/lib/python3.14t/concurrent/futures/__init__.py", line 47, in __dir__
    return __all__ + ('__author__', '__doc__')
           ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
TypeError: can only concatenate list (not "tuple") to list

There's a typo in the __dir__ function; it is trying to concatenate a list and a tuple. I could do [*__all__ , '__author__', '__doc__'] instead if that's preferred.

I didn't make an issue, but I can if that's preferred. Needs backport to 3.14. Also didn't add a test, but a test that checks dir on all modules would be useful. Static typing would have caught this.

Bug introduced in #136381.

@serhiy-storchaka
Copy link
Member

Lib/test/test___all__.py may be a good place for the dir() tests.

@ZeroIntensity
Copy link
Member

I didn't make an issue, but I can if that's preferred.

I think it'd be a good idea to make an issue, as this should probably be a release blocker.

@ZeroIntensity ZeroIntensity added the needs backport to 3.14 bugs and security fixes label Jul 30, 2025
@henryiii
Copy link
Contributor Author

Okay, I will when not on an airplane. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants