@@ -80,20 +80,18 @@ func chdir(self py.Object, args py.Tuple) (py.Object, error) {
8080 return nil , py .ExceptionNewf (py .TypeError , "Missing required argument 'path' (pos 1)" )
8181 }
8282 if ! objectIsString (args [0 ]) {
83- return nil , py .ExceptionNewf (py .TypeError , "str expected, not " + args [0 ].Type ().Name )
83+ return nil , py .ExceptionNewf (py .TypeError , "str expected, not " + args [0 ].Type ().Name )
8484 }
85- dir , err := py .ReprAsString (args [0 ])
86- if err != nil {
87- return nil , py .ExceptionNewf (py .TypeError , "Failed to parse string" ) // never going to run
88- }
89- dir = strings .ReplaceAll (dir , "'" , "" )
90- err = os .Chdir (dir )
91- if err != nil {
92- return nil , py .ExceptionNewf (py .NotADirectoryError , "Couldn't change cwd; " + err .Error ())
93- }
94- return py .None , nil
85+ dir , err := py .ReprAsString (args [0 ])
86+ if err != nil {
87+ return nil , py .ExceptionNewf (py .TypeError , "Failed to parse string" ) // never going to run
9588 }
96- return nil , py .ExceptionNewf (py .TypeError , "str expected, not " + args [0 ].Type ().Name )
89+ dir = strings .ReplaceAll (dir , "'" , "" )
90+ err = os .Chdir (dir )
91+ if err != nil {
92+ return nil , py .ExceptionNewf (py .NotADirectoryError , "Couldn't change cwd; " + err .Error ())
93+ }
94+ return py .None , nil
9795}
9896
9997// get a enviroment variable by key
0 commit comments