File tree Expand file tree Collapse file tree 1 file changed +15
-14
lines changed Expand file tree Collapse file tree 1 file changed +15
-14
lines changed Original file line number Diff line number Diff line change @@ -378,20 +378,21 @@ def _parse_and_extend_config_file(
378378
379379 extend = parser ["mypy" ].pop ("extend" , None )
380380 if extend :
381- cwd = os .getcwd ()
382- try :
383- # process extend relative to the directory where we found current config
384- os .chdir (os .path .dirname (abs_file_read ))
385- parse_ret = _parse_and_extend_config_file (
386- options = options ,
387- set_strict_flags = set_strict_flags ,
388- filename = os .path .abspath (expand_path (extend )),
389- stdout = stdout ,
390- stderr = stderr ,
391- visited = visited ,
392- )
393- finally :
394- os .chdir (cwd )
381+ parse_ret = _parse_and_extend_config_file (
382+ options = options ,
383+ set_strict_flags = set_strict_flags ,
384+ # refer to extend relative to directory where we found current config
385+ filename = os .path .relpath (
386+ os .path .normpath (
387+ os .path .join (
388+ os .path .dirname (abs_file_read ), expand_path (extend )
389+ )
390+ )
391+ ),
392+ stdout = stdout ,
393+ stderr = stderr ,
394+ visited = visited ,
395+ )
395396
396397 if parse_ret is None :
397398 print (f"{ extend } is not a valid path to extend from { abs_file_read } " , file = stderr )
You can’t perform that action at this time.
0 commit comments