@@ -80,20 +80,18 @@ func chdir(self py.Object, args py.Tuple) (py.Object, error) {
80
80
return nil , py .ExceptionNewf (py .TypeError , "Missing required argument 'path' (pos 1)" )
81
81
}
82
82
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 )
84
84
}
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
95
88
}
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
97
95
}
98
96
99
97
// get a enviroment variable by key
0 commit comments