Skip to content

Conversation

Fidget-Spinner
Copy link
Member

@Fidget-Spinner Fidget-Spinner commented Sep 3, 2025

The problem is that when something round-trips through str or tuple, it isn't guaranteed to maintain the same reference information.

The test script deals \with some quirks of immortalization/interning in CPython.

@markshannon
Copy link
Member

I don't think this has anything to do with string interning, but that tuple(t) and str(s) return a new reference to the object.
What was a deferred reference becomes non-deferred when returned from a call.

@Fidget-Spinner
Copy link
Member Author

Fidget-Spinner commented Sep 3, 2025

I don't think this has anything to do with string interning, but that tuple(t) and str(s) return a new reference to the object. What was a deferred reference becomes non-deferred when returned from a call.

Yes I'm aware. Sorry that I didn't put it in the first sentence. What I was talking about (interning/immortalization) is a quirk of why the test script is written that way. For some reason if it's in a separate script, it stays non-immortal but interned, but if it's in the same test file, it stays immortal and interned, causing some weird behavior.

Fidget-Spinner and others added 2 commits September 4, 2025 01:19
Co-Authored-By: Mark Shannon <9448417+markshannon@users.noreply.github.com>
Copy link
Member

@markshannon markshannon left a comment

Choose a reason for hiding this comment

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

Looks good

@Fidget-Spinner Fidget-Spinner merged commit 2402f84 into python:main Sep 3, 2025
64 checks passed
@miss-islington-app
Copy link

Thanks @Fidget-Spinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

@Fidget-Spinner Fidget-Spinner deleted the fix-ref-str-tup branch September 3, 2025 18:05
@miss-islington-app
Copy link

Sorry, @Fidget-Spinner, I could not cleanly backport this to 3.14 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 2402f84665df41732c94db2ccd6f90dd13479fa8 3.14

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.

2 participants