Skip to content

gh-135513: Fix unused variable warning in crossinterp.c #135514

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 16, 2025

Conversation

sobolevn
Copy link
Member

@sobolevn sobolevn commented Jun 14, 2025

Copy link
Member

@picnixz picnixz left a comment

Choose a reason for hiding this comment

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

It's undeclared now at line 2664 I think

@sobolevn sobolevn added the needs backport to 3.14 bugs and security fixes label Jun 14, 2025
@sobolevn
Copy link
Member Author

@picnixz I want to be sure that tstate does not change between these calls, because we can see that some other parts of this code changes tstate. So, maybe it is not safe to inline these calls like that? Let's be extra careful and use #ifdef instead 🤔

@picnixz
Copy link
Member

picnixz commented Jun 15, 2025

I want to be sure that tstate does not change between these calls, because we can see that some other parts of this code changes tstate

I also thought about it but ISTM that the following wouldn't make sense otherwise:

PyThreadState *tstate = _PyThreadState_GET();
...
if (_fill_sharedns(sharedns, nsupdates, fallback, &_err) < 0) {
    assert(_PyErr_Occurred(tstate));
    ...
}

But it's a good idea to use ifdefs just for that. We can also ask @ericsnowcurrently if our analysis is correct

@sobolevn
Copy link
Member Author

I went with the safest bet: #ifndef NDEBUG

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

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

LGTM. I wrote the same fix before finding this PR.

Copy link
Member

@ericsnowcurrently ericsnowcurrently left a comment

Choose a reason for hiding this comment

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

LGTM

@vstinner vstinner merged commit 4c15505 into python:main Jun 16, 2025
38 checks passed
@miss-islington-app
Copy link

Thanks @sobolevn for the PR, and @vstinner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 16, 2025
…onGH-135514)

(cherry picked from commit 4c15505)

Co-authored-by: sobolevn <mail@sobolevn.me>
@bedevere-app
Copy link

bedevere-app bot commented Jun 16, 2025

GH-135577 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.14 bugs and security fixes label Jun 16, 2025
@vstinner
Copy link
Member

I merged the PR since the warning is annoying me on multiple PRs and the change was approved 3 times :-)

@ericsnowcurrently
Copy link
Member

My apologies for missing this in the original PR. Thanks for the fix, @sobolevn!

@sobolevn
Copy link
Member Author

Thanks all!

vstinner pushed a commit that referenced this pull request Jun 16, 2025
…135514) (#135577)

gh-135513: Fix unused variable warning in `crossinterp.c` (GH-135514)
(cherry picked from commit 4c15505)

Co-authored-by: sobolevn <mail@sobolevn.me>
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