Skip to content

Simplify the base classes of _PyFutureMeta#157757

Closed
stroxler wants to merge 1 commit intopytorch:mainfrom
stroxler:simplify_future
Closed

Simplify the base classes of _PyFutureMeta#157757
stroxler wants to merge 1 commit intopytorch:mainfrom
stroxler:simplify_future

Conversation

@stroxler
Copy link
Contributor

@stroxler stroxler commented Jul 8, 2025

Summary:

I'm fairly sure the use of a custom metaclass is a holdover from pre-3.7 where Generic used a custom metaclass so we had to use multiple inheritance to avoid import-time failures.

At this point, type(Generic) is just type so it isn't needed, and we will get the least metaclass from our base classes, which means the type(torch._C.Future) isn't needed either, it will happen automatically just by inheritance.

Test Plan:

I'm fairly confident from local testing that this should be a no-op.

But also, Pytorch CI should give us pretty strong signal that this change doesn't break anything in case there's some edge case I missed.

cc @ezyang @malfet @xuzhao9 @gramster

@pytorch-bot
Copy link

pytorch-bot bot commented Jul 8, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/157757

Note: Links to docs will display an error until the docs builds have been completed.

❌ 4 Cancelled Jobs

As of commit af82c71 with merge base f56bfb3 (image):

CANCELLED JOBS - The following jobs were cancelled. Please retry:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@stroxler stroxler added module: typing Related to mypy type annotations topic: not user facing topic category labels Jul 8, 2025
@ezyang
Copy link
Contributor

ezyang commented Jul 8, 2025

@pytorchbot merge -r

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Jul 8, 2025
@pytorchmergebot
Copy link
Collaborator

@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here

@pytorchmergebot
Copy link
Collaborator

Tried to rebase and push PR #157757, but it was already up to date. Try rebasing against main by issuing:
@pytorchbot rebase -b main

@pytorchmergebot
Copy link
Collaborator

The merge job was canceled or timed out. This most often happen if two merge requests were issued for the same PR, or if merge job was waiting for more than 6 hours for tests to finish. In later case, please do not hesitate to reissue the merge command
For more information see pytorch-bot wiki.

@ezyang
Copy link
Contributor

ezyang commented Jul 8, 2025

@pytorchbot merge

@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@pytorchmergebot
Copy link
Collaborator

Merge failed

Reason: 1 mandatory check(s) failed. The first few are:

Dig deeper by viewing the failures on hud

Details for Dev Infra team Raised by workflow job

Failing merge rule: Core Maintainers

@ezyang
Copy link
Contributor

ezyang commented Jul 8, 2025

@pytorchbot rebase -b main

@pytorchmergebot
Copy link
Collaborator

@pytorchbot started a rebase job onto refs/remotes/origin/main. Check the current status here

Summary:

I'm fairly sure the use of a custom metaclass is a holdover
from pre-3.7 where Generic used a custom metaclass so we had to
use multiple inheritance to avoid import-time failures.

At this point, `type(Generic)` is just `type` so it isn't needed,
and we will get the least metaclass from our base classes, which
means the `type(torch._C.Future)` isn't needed either, it will
happen automatically just by inheritance.

Test Plan:

I'm fairly confident from local testing that this should be a no-op.

But also, Pytorch CI should give us pretty strong signal that this
change doesn't break anything in case there's some edge case I missed.
@pytorchmergebot
Copy link
Collaborator

Successfully rebased simplify_future onto refs/remotes/origin/main, please pull locally before adding more changes (for example, via git checkout simplify_future && git pull --rebase)

@ezyang
Copy link
Contributor

ezyang commented Jul 8, 2025

@pytorchbot merge

@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@pytorchmergebot
Copy link
Collaborator

Merge failed

Reason: 1 jobs have failed, first few of them are: trunk / macos-py3-arm64 / build

Details for Dev Infra team Raised by workflow job

@Skylion007
Copy link
Collaborator

@pytorchbot merge -f

@pytorch-bot
Copy link

pytorch-bot bot commented Jul 8, 2025

❌ 🤖 pytorchbot command failed:

@pytorchbot merge: error: argument -f/--force: expected one argument

usage: @pytorchbot merge [-f MESSAGE | -i] [-ic] [-r [{viable/strict,main}]]

Try @pytorchbot --help for more info.

@Skylion007
Copy link
Collaborator

@pytorchbot merge -f "cancelled jobs are unrelated"

@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged immediately since you used the force (-f) flag, bypassing any CI checks (ETA: 1-5 minutes). Please use -f as last resort and instead consider -i/--ignore-current to continue the merge ignoring current failures. This will allow currently pending tests to finish and report signal before the merge.

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

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

Labels

ciflow/trunk Trigger trunk jobs on your pull request Merged module: typing Related to mypy type annotations topic: not user facing topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants