Skip to content

[site] add(user)sitepackages(known_paths) shouldn't be None#15866

Open
srittau wants to merge 1 commit into
python:mainfrom
srittau:site-known-paths
Open

[site] add(user)sitepackages(known_paths) shouldn't be None#15866
srittau wants to merge 1 commit into
python:mainfrom
srittau:site-known-paths

Conversation

@srittau
Copy link
Copy Markdown
Collaborator

@srittau srittau commented Jun 4, 2026

No description provided.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 4, 2026

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@JelleZijlstra
Copy link
Copy Markdown
Member

Why? They just pass known_paths on to addsitedir, which does accept None for known_paths. Here is the code for 3.14: https://github.com/python/cpython/blob/35ec25553e7ab13c7a3ad90a3ecd2bc27a8fcd5e/Lib/site.py#L423

@srittau
Copy link
Copy Markdown
Collaborator Author

srittau commented Jun 4, 2026

Yes, but that is kind of pointless, and indicates a misunderstanding of the API. (At least that is how I understand the API.) Also, if we allow None we should overloads for the return type, as the supplied input type is returned.

Overall, not a super significant change, but an improvement, in my opinion.

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