Fix 3.15 stdlib stubtest#15863
Conversation
This comment has been minimized.
This comment has been minimized.
| def addsitepackages(known_paths: set[str] | None, prefixes: Iterable[str] | None = None) -> set[str] | None: ... # undocumented | ||
| def addusersitepackages(known_paths: set[str] | None) -> set[str] | None: ... # undocumented |
There was a problem hiding this comment.
Should this really allow a known_paths argument to be None? From the way it's supposed to be used that doesn't make too much sense to me.
| def addsitepackages(known_paths: set[str] | None, prefixes: Iterable[str] | None = None) -> set[str] | None: ... # undocumented | |
| def addusersitepackages(known_paths: set[str] | None) -> set[str] | None: ... # undocumented | |
| def addsitepackages(known_paths: set[str], prefixes: Iterable[str] | None = None) -> set[str]: ... # undocumented | |
| def addusersitepackages(known_paths: set[str]) -> set[str]: ... # undocumented |
There was a problem hiding this comment.
Hmm, this just matches the previous annotations here. I haven't changed the types of any of these parameters in this PR. I'm open to changing them, but I think it's outside the scope of this PR
There was a problem hiding this comment.
Oh, I think the lines are marked as "changed", since the indentation (for the >= (3, 15) block) got lost. Can you check that, it's always a bit hard to see in GitHub diffs.
There was a problem hiding this comment.
Previous patch releases of 3.15 added a defer_processing_start_files: bool = False parameter to these three functions, which meant that we had to have two branches: one if sys.version_info >= (3, 15) branch, and an else branch for earlier definitions that didn't have the new parameter. That parameter addition has now been reverted; the definition is now the same on 3.15 as it was on earlier Python versions. So this PR collapses the two sys.version_info branches into one block at the module level for addsitedir, addsitepackages and addusersitepackages. That's why these lines show up as "changed" in the GitHub diff. The functions have exactly the same signature that they had previously in the Python <3.15 branch
Co-authored-by: Sebastian Rittau <sebastian.rittau@zfutura.de>
|
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
| def addsitedir(sitedir: str, known_paths: set[str] | None = None) -> None: ... | ||
| def addsitepackages(known_paths: set[str] | None, prefixes: Iterable[str] | None = None) -> set[str] | None: ... # undocumented | ||
| def addusersitepackages(known_paths: set[str] | None) -> set[str] | None: ... # undocumented |
There was a problem hiding this comment.
I assume this was a mistake?
| def addsitedir(sitedir: str, known_paths: set[str] | None = None) -> None: ... | |
| def addsitepackages(known_paths: set[str] | None, prefixes: Iterable[str] | None = None) -> set[str] | None: ... # undocumented | |
| def addusersitepackages(known_paths: set[str] | None) -> set[str] | None: ... # undocumented | |
| def addsitedir(sitedir: str, known_paths: set[str] | None = None) -> None: ... | |
| def addsitepackages(known_paths: set[str] | None, prefixes: Iterable[str] | None = None) -> set[str] | None: ... # undocumented | |
| def addusersitepackages(known_paths: set[str] | None) -> set[str] | None: ... # undocumented |
There was a problem hiding this comment.
no, not a mistake -- see my reply at #15863 (comment). We don't need split definitions over two sys.version_info branches anymore
There was a problem hiding this comment.
Hmm, they exist on 3.14, but why were they indented before? Maybe we should move the whole problem with these functions to another PR altogether.
There was a problem hiding this comment.
Again, I explained this in #15863 (comment). We previously had this:
if sys.version_info >= (3, 15):
def addsitedir(new_parameter): ...
else:
def addsitedir(): ...but the addition of the new parameter in 3.15 was reverted, so now we just have this again, removing the indentation that was previously necessary:
def addsitedir(): ...
Helps with #15861 (but there's some third-party stubtest failures too)