Skip to content

gh-137282: Fix tab completion and dir() on concurrent.futures #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

Merged
merged 4 commits into from
Jul 31, 2025

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. :)

@henryiii henryiii changed the title fix: dir(concurrent.futures) and tab completion broken gh-137282: dir(concurrent.futures) and tab completion broken Jul 31, 2025
Copy link
Member

@ZeroIntensity ZeroIntensity left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a news entry and simple test.

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
@henryiii
Copy link
Contributor Author

Yes, I'm working on that. :)

@AA-Turner AA-Turner changed the title gh-137282: dir(concurrent.futures) and tab completion broken gh-137282: dir(concurrent.futures) and tab completion broken Jul 31, 2025
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
@henryiii
Copy link
Contributor Author

I've started by adding a small change to the all test that fails before and works after this patch. I could split it out into a separate test or even separate file if that's better.

Copy link
Member

@ZeroIntensity ZeroIntensity left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that works fine as a test, we don't need anything very special.

LGTM, with a few minor comments regarding formatting.

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
@serhiy-storchaka serhiy-storchaka changed the title gh-137282: dir(concurrent.futures) and tab completion broken gh-137282: Fix tab completion and dir() on concurrent.futures Jul 31, 2025
Copy link
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. 👍

@ZeroIntensity ZeroIntensity enabled auto-merge (squash) July 31, 2025 15:28
@ZeroIntensity ZeroIntensity merged commit 2a87af0 into python:main Jul 31, 2025
73 of 75 checks passed
@miss-islington-app
Copy link

Thanks @henryiii for the PR, and @ZeroIntensity for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 31, 2025
…ncurrent.futures` (pythonGH-137214)

(cherry picked from commit 2a87af0)

Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
@bedevere-app
Copy link

bedevere-app bot commented Jul 31, 2025

GH-137284 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.14 bugs and security fixes label Jul 31, 2025
@bedevere-bot
Copy link

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot AMD64 FreeBSD Refleaks 3.x (tier-3) has failed when building commit 2a87af0.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/1613/builds/1759) and take a look at the build logs.
  4. Check if the failure is related to this commit (2a87af0) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#/builders/1613/builds/1759

Summary of the results of the build (if available):

==

Click to see traceback logs
Traceback (most recent call last):
  File "/buildbot/buildarea/3.x.ware-freebsd.refleak/build/Lib/test/support/__init__.py", line 838, in gc_collect
    gc.collect()
ResourceWarning: unclosed <socket.socket fd=9, family=2, type=1, proto=6, laddr=('127.0.0.1', 18243), raddr=('127.0.0.1', 18244)>
Task was destroyed but it is pending!
task: <Task pending name='Task-99' coro=<BaseSelectorEventLoop._accept_connection2() done, defined at /buildbot/buildarea/3.x.ware-freebsd.refleak/build/Lib/asyncio/selector_events.py:217> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Warning -- Unraisable exception
Exception ignored while calling deallocator <function _SelectorTransport.__del__ at 0x843173410>:
Traceback (most recent call last):
  File "/buildbot/buildarea/3.x.ware-freebsd.refleak/build/Lib/asyncio/selector_events.py", line 873, in __del__
    _warn(f"unclosed transport {self!r}", ResourceWarning, source=self)
ResourceWarning: unclosed transport <_SelectorSocketTransport closing fd=9>
k


Traceback (most recent call last):
  File "/buildbot/buildarea/3.x.ware-freebsd.refleak/build/Lib/test/support/__init__.py", line 838, in gc_collect
    gc.collect()
ResourceWarning: unclosed <socket.socket fd=9, family=2, type=1, proto=6, laddr=('127.0.0.1', 35930), raddr=('127.0.0.1', 35931)>
Task was destroyed but it is pending!
task: <Task pending name='Task-3855' coro=<BaseSelectorEventLoop._accept_connection2() done, defined at /buildbot/buildarea/3.x.ware-freebsd.refleak/build/Lib/asyncio/selector_events.py:217> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Warning -- Unraisable exception
Exception ignored while calling deallocator <function _SelectorTransport.__del__ at 0x8431d7410>:
Traceback (most recent call last):
  File "/buildbot/buildarea/3.x.ware-freebsd.refleak/build/Lib/asyncio/selector_events.py", line 873, in __del__
    _warn(f"unclosed transport {self!r}", ResourceWarning, source=self)
ResourceWarning: unclosed transport <_SelectorSocketTransport closing fd=9>
k

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

Successfully merging this pull request may close these issues.

5 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy