Skip to content

Conversation

@vstinner
Copy link
Member

@vstinner vstinner commented Dec 5, 2025

Example of fixed warning:

Lib/functools.py:690:21: local variable 'oldresult'
is assigned to but never used

Example of fixed warning:

    Lib/functools.py:690:21: local variable 'oldresult'
    is assigned to but never used
# still adjusting the links.
root = oldroot[NEXT]
oldkey = root[KEY]
oldresult = root[RESULT]
Copy link
Member

Choose a reason for hiding this comment

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

Wasn't this one important?

Copy link
Member Author

Choose a reason for hiding this comment

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

Would you mind to elaborate? Important for what?

Copy link
Member

@picnixz picnixz Dec 5, 2025

Choose a reason for hiding this comment

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

There is the comment just above:

# Empty the oldest link and make it the new root.
# Keep a reference to the old key and old result to
# prevent their ref counts from going to zero during the
# update. That will prevent potentially arbitrary object
# clean-up code (i.e. __del__) from running while we're
# still adjusting the links.

which says that we want to keep a reference to the old result before doing the update. I would suggest using a noqa suppression to avoid hitting this one.

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.

4 participants