Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

Avasam
Copy link
Contributor

@Avasam Avasam commented Mar 6, 2024

Summary of changes

Should fix the last errors in #4246. These are all actual code changes, please review carefully.

Pull Request Checklist

@Avasam Avasam changed the title pkg_resoruces: Runtime fixes to make typing annotations work pkg_resources: Runtime fixes to make typing annotations work Mar 7, 2024
path = sys.path
self.insert_on(path, replace=replace)
if path is sys.path:
if path is sys.path and self.location:
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if it is possible that self.location is an empty string...
The empty string is a valid entry for sys.path (and holds special meaning).

Copy link
Contributor Author

@Avasam Avasam Mar 8, 2024

Choose a reason for hiding this comment

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

Just in case:

Suggested change
if path is sys.path and self.location:
if path is sys.path and self.location is not None:

But I am unsure if we should raise early or gracefully "do nothing" on None

@Avasam Avasam requested a review from abravalheri April 21, 2024 20:26
@abravalheri abravalheri merged commit 6dc694e into pypa:main May 7, 2024
@abravalheri
Copy link
Contributor

Thank you very much @Avasam.

@Avasam Avasam deleted the pkg_resoruces-typign-fixes-for-annotations branch May 7, 2024 18:17
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