Skip to content

[3.14] Add python version adjustment for frame count changes#168190

Closed
fxdawnn wants to merge 2 commits intogh/fxdawnn/13/basefrom
gh/fxdawnn/13/head
Closed

[3.14] Add python version adjustment for frame count changes#168190
fxdawnn wants to merge 2 commits intogh/fxdawnn/13/basefrom
gh/fxdawnn/13/head

Conversation

@fxdawnn
Copy link
Contributor

@fxdawnn fxdawnn commented Nov 19, 2025

Stack from ghstack (oldest at bottom):

sys.getrefcount(lib) got impacted due to python3.13 optimization. sys.getrefcount(lib._op_impls) and others remain the same.

Test plan:
python test/test_python_dispatch.py TestPythonRegistration.test_finalizer in local python=3.14 env

@pytorch-bot
Copy link

pytorch-bot bot commented Nov 19, 2025

🔗 Helpful Links

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

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

✅ No Failures

As of commit a033cda with merge base 7a92839 (image):
💚 Looks good so far! There are no failures yet. 💚

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

@pytorch-bot pytorch-bot bot added the topic: not user facing topic category label Nov 19, 2025
fxdawnn added a commit that referenced this pull request Nov 19, 2025
ghstack-source-id: deb9fce
Pull Request resolved: #168190
Copy link
Member

@williamwen42 williamwen42 left a comment

Choose a reason for hiding this comment

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

hmm, interesting that 3.13 seems to be affected by this too?

@fxdawnn
Copy link
Contributor Author

fxdawnn commented Nov 19, 2025

hmm, interesting that 3.13 seems to be affected by this too?

waiting for CI changes to confirm.

``sys.getrefcount(lib)`` got impacted due to python3.13 optimization. ``sys.getrefcount(lib._op_impls)`` and others remain the same.

Test plan:
``python test/test_python_dispatch.py TestPythonRegistration.test_finalizer`` in local ``python=3.14`` env



[ghstack-poisoned]
fxdawnn added a commit that referenced this pull request Nov 19, 2025
@fxdawnn fxdawnn changed the title Add python version adjustment for frame count changes [3.14] Add python version adjustment for frame count changes Nov 19, 2025
@fxdawnn
Copy link
Contributor Author

fxdawnn commented Nov 20, 2025

@pytorchbot merge

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Nov 20, 2025
@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

# 1 for `lib`, 1 for sys.getrefcount' for previous python version (<=3.12)
# In Python 3.13+, sys.getrefcount() was optimized to not create
# a temporary reference, so expected counts are 1 less than before
expected_refcount = 1 if sys.version_info >= (3, 14) else 2
Copy link
Collaborator

Choose a reason for hiding this comment

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

do we generally hardcode this type of information in code - wondering if we have config files to track such changes @williamwen42?

JacobSzwejbka pushed a commit that referenced this pull request Dec 8, 2025
``sys.getrefcount(lib)`` got impacted due to python3.13 optimization. ``sys.getrefcount(lib._op_impls)`` and others remain the same.

Test plan:
``python test/test_python_dispatch.py TestPythonRegistration.test_finalizer`` in local ``python=3.14`` env

Pull Request resolved: #168190
Approved by: https://github.com/williamwen42, https://github.com/azahed98
@github-actions github-actions bot deleted the gh/fxdawnn/13/head branch December 26, 2025 02:19
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 topic: not user facing topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants