Skip to content

Commit 896709e

Browse files
author
hauntsaninja
committed
fix package root validation
1 parent 30177ca commit 896709e

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

mypy/main.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -974,7 +974,6 @@ def process_package_roots(fscache: Optional[FileSystemCache],
974974
assert fscache is not None # Since mypy doesn't know parser.error() raises.
975975
# Do some stuff with drive letters to make Windows happy (esp. tests).
976976
current_drive, _ = os.path.splitdrive(os.getcwd())
977-
dotdotslash = os.pardir + os.sep
978977
package_root = []
979978
for root in options.package_root:
980979
if os.path.isabs(root):
@@ -985,7 +984,7 @@ def process_package_roots(fscache: Optional[FileSystemCache],
985984
# Empty package root is always okay.
986985
if not root:
987986
root = os.curdir
988-
if os.path.relpath(root).startswith(dotdotslash):
987+
if os.path.relpath(root).split(os.sep)[0] == os.pardir:
989988
parser.error("Package root cannot be above current directory: %r" % root)
990989
root = os.path.normpath(os.path.abspath(root))
991990
if not root.endswith(os.sep):

0 commit comments

Comments
 (0)