Skip to content
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

Incorrect configuration exclusions for Windows Py>3.10?? #4114

Open
MusicalNinjaDad opened this issue Apr 24, 2024 · 0 comments
Open

Incorrect configuration exclusions for Windows Py>3.10?? #4114

MusicalNinjaDad opened this issue Apr 24, 2024 · 0 comments

Comments

@MusicalNinjaDad
Copy link

While working on another topic I noticed this cfg entry:

            // PyInterpreterState_Get is only available on 3.9 and later, but is missing
            // from python3.dll for Windows stable API on 3.9
            #[cfg(all(Py_3_9, not(all(windows, Py_LIMITED_API, not(Py_3_10)))))]

at

// PyInterpreterState_Get is only available on 3.9 and later, but is missing

and then negated at
#[cfg(not(all(Py_3_9, not(all(windows, Py_LIMITED_API, not(Py_3_10))))))]

I don't have an environment in place to test, nor have I experienced any issues with this, but reading the logic it seems to be potentially incorrect and I thought it safer to point this out at the risk of raising an incorrect issue.

I think that the not(all(windows, Py_LIMITED_API, not(Py_3_10))) clause cannot be true if Py_3_9 is true - as the windows clause requires Py_3_10. Logically: 3.9 AND (NOT (win AND Lim AND NOT 3.10)) = 3.9 AND NOT win AND NOT Lim AND 3.10 (but my brain is hurting already ;))

If I understand the comment correctly then the first code block should only be executed on >3.10 on windows or on >3.9 on other platforms. This would suggest the logic similar to: (3.9 AND NOT win) OR 3.10.

Assuming that the cfg flag Py_3_x equivalent to >=Py3.x then I think this should translate to something like: #[cfg(any(Py_3_10, all(Py_3_9, not(all(windows, Py_LIMITED_API))))] - that should also be not-able for the second block ...

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

No branches or pull requests

1 participant