Skip to content

Fix --custom-typeshed-dir crash caused by #13155 #13296

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

Merged
merged 3 commits into from
Aug 1, 2022

Conversation

AlexWaygood
Copy link
Member

@AlexWaygood AlexWaygood commented Jul 31, 2022

Description

This seems to fix #13295.

Test Plan

I manually verified that this fixes #13295. Not sure how or where to add a test. I also added a test case to test-data/unit/cmdline.test which reproduces the crash on master, but passes with this patch applied.

@github-actions

This comment has been minimized.

@AlexWaygood AlexWaygood changed the title Fix stubtest crash caused by #13155 Fix --custom-typeshed-dir crash caused by #13155 Jul 31, 2022
@github-actions

This comment has been minimized.

1 similar comment
@github-actions
Copy link
Contributor

github-actions bot commented Aug 1, 2022

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

@@ -674,6 +674,7 @@ def __init__(
if options.custom_typeshed_dir is not None:
# Check if module lives under custom_typeshed_dir subtree
custom_typeshed_dir = os.path.abspath(options.custom_typeshed_dir)
path = os.path.abspath(path)
if os.path.commonpath((path, custom_typeshed_dir)) == custom_typeshed_dir:
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe it still can through ValueError on Windows if path and custom_typeshed_dir live on different drives.

Copy link
Member Author

@AlexWaygood AlexWaygood Aug 1, 2022

Choose a reason for hiding this comment

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

Good point (though I'm tempted to say that anybody trying to do that deserves what they're getting!)

Copy link
Collaborator

@hauntsaninja hauntsaninja left a comment

Choose a reason for hiding this comment

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

Thanks!

@hauntsaninja hauntsaninja merged commit 9d03933 into python:master Aug 1, 2022
@AlexWaygood AlexWaygood deleted the fix-stubtestcrash branch August 1, 2022 21:52
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.

Crash on master branch when using --custom-typeshed-dir with a relative path
3 participants