Skip to content

Give concurrent.future.Future the right module name - #115386

Open
pelson wants to merge 1 commit into
python:mainfrom
pelson:feature/concurrent-future-exception-location
Open

Give concurrent.future.Future the right module name#115386
pelson wants to merge 1 commit into
python:mainfrom
pelson:feature/concurrent-future-exception-location

Conversation

@pelson

@pelson pelson commented Feb 13, 2024

Copy link
Copy Markdown
Contributor

Currently the classes in concurrent.futures give unexpected/internal sub-package names for __str__ of the class:

$ python3 -c "import concurrent.futures as f; print(f.Future)"
<class 'concurrent.futures._base.Future'>

After this change, they get the intended (and documented) location.

This is an aesthetic change to make it easier to correlate an object with its documentation, and does cause a noteworthy issue beyond that.

I did not include the executor implementations in this change as they are implemented in a non-private module. However, the documentation does state that they come from concurrent.futures:

python3 -c "import concurrent.futures as f; print(f.ThreadPoolExecutor)"
<class 'concurrent.futures.thread.ThreadPoolExecutor'>

I did some research, and there are a few occurrences in the CPython implementation of re-defining __module__ in this way (examples include re, abc, and io).

@github-actions

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Apr 15, 2026
@pelson

pelson commented Apr 15, 2026

Copy link
Copy Markdown
Contributor Author

There is nothing stale about it - it just needs a reviewer. It is a fairly trivial change.

@github-actions github-actions Bot removed the stale Stale PR or inactive for long period of time. label May 12, 2026
@github-actions

Copy link
Copy Markdown

This PR is stale because it has been open for 90 days with no activity.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Aug 13, 2026
@aisk

aisk commented Aug 13, 2026

Copy link
Copy Markdown
Member

Currently there are more classes in this file, eg. InvalidStateError, which don't have __module__ set, so I think this PR is stale (or incomplete) now. And since this is a user visible change, the news entry and issue should not be skipped.

@github-actions github-actions Bot removed the stale Stale PR or inactive for long period of time. label Aug 15, 2026
@pelson
pelson force-pushed the feature/concurrent-future-exception-location branch 2 times, most recently from f34ab06 to 7bb8f18 Compare August 18, 2026 02:19
@pelson
pelson force-pushed the feature/concurrent-future-exception-location branch from 7bb8f18 to 028c70d Compare August 18, 2026 02:34
@aisk

aisk commented Aug 18, 2026

Copy link
Copy Markdown
Member

Hi, please avoid force push in the future, see: https://devguide.python.org/getting-started/pull-request-lifecycle/#don-t-force-push

@pelson

pelson commented Aug 18, 2026

Copy link
Copy Markdown
Contributor Author

Hi, please avoid force push in the future, see: https://devguide.python.org/getting-started/pull-request-lifecycle/#don-t-force-push

Thanks for letting me know. In this case, I thought the change was relevant to embed into a single commit (and it needed rebasing anyway), but I will be sure to not do this in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants