Repository navigation
[dynamo] Migrate ContextVarVariable methods to tp_methods - #195167
Closed
PrabinDevkota wants to merge 1 commit into
Closed
PrabinDevkota wants to merge 1 commit into
PrabinDevkota wants to merge 1 commit into
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/195167
Note: Links to docs will display an error until the docs builds have been completed. ✅ You can merge normally! (3 Unrelated Failures)As of commit 24c2794 with merge base 6a211a9 ( BROKEN TRUNK - The following job failed but were present on the merge base:👉 Rebase onto the `viable/strict` branch to avoid these failures
CRCR (non-blocking) - The following CRCR downstream CI jobs failed but are non-blocking:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
|
Contributor
Author
|
@pytorchbot label "topic: not user facing" |
Collaborator
|
@pytorchbot merge -i |
Collaborator
Merge startedYour change will be merged while ignoring the following 1 checks: torchtitan-test / torchtitan-x-pytorch-test / test (torchtitan_models_integration, 1, 1, mt-l-x86aavx2-189-704-a10g-8) Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
12 of 18 tasks
Sanskaaar1
pushed a commit
to Sanskaaar1/pytorch
that referenced
this pull request
Sep 8, 2026
…5167) ## Summary Migrate `ContextVarVariable` off a `call_method` if-chain onto declarative `tp_methods`, as in pytorch#195165. `get` / `set` / `reset` are now `Method` handlers. Arity comes from CPython `ml_flags` (`METH_FASTCALL` for `get`, `METH_O` for `set`/`reset`). The extra-positional check on `get` is kept because FASTCALL does not cap at one argument. `set` / `reset` still graph-break. Part of pytorch#195165 (does not close the umbrella). ## Test plan - [x] `python test/dynamo/test_contextvars.py` (24 passed) Pull Request resolved: pytorch#195167 Approved by: https://github.com/guilhermeleobas
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Migrate
ContextVarVariableoff acall_methodif-chain onto declarativetp_methods, as in #195165.get/set/resetare nowMethodhandlers. Arity comes from CPythonml_flags(METH_FASTCALLforget,METH_Oforset/reset). The extra-positional check ongetis kept because FASTCALL does not cap at one argument.set/resetstill graph-break.Part of #195165 (does not close the umbrella).
Test plan
python test/dynamo/test_contextvars.py(24 passed)cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @kadeng @chauhang @amjames @jataylo @azahed98