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

Type setuptools/msvc.py dir methods and properties #4755

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Avasam
Copy link
Contributor

@Avasam Avasam commented Nov 20, 2024

Summary of changes

Extracted from #4744 with additional fixes

Pull Request Checklist

Comment on lines -719 to +723
return sdkdir or ''
return sdkdir

return None
return ''
Copy link
Contributor Author

@Avasam Avasam Nov 20, 2024

Choose a reason for hiding this comment

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

This one I'm not entirely certain of, and does change the possible return types.

dir-related properties of this class are a mixed bag on whether they return None or '' as a fallthrough case. And are almost never documented as returning None (which is fixed in this PR).

However all other properties that can return None are checked for truthiness when used, this one isn't. (hence it was causing issues for #4744)

The redundant or '' makes me think this may have been intended to not return None. But the true intention is unclear to me.


After further research, it was auto-added here as an explicit return: https://github.com/pypa/setuptools/pull/4169/files#diff-2f10e0b183f00587feb575c7716d38f4951d4f7ded5b714396e96066ae7254bdR953

Now I'm pretty sure that the original intention was to return a '' by default. But that means maybe other methods as well ?

Anyway, if you think this should return None by default, I'll add checks to the methods that use this property instead.

@Avasam Avasam force-pushed the type-msvc-dir-methods-and-properties branch from 61b15bf to 5ab8346 Compare November 20, 2024 20:46
@Avasam Avasam force-pushed the type-msvc-dir-methods-and-properties branch from 5ab8346 to 6ad33ba Compare November 24, 2024 22:53
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.

1 participant