Skip to content

Commit 18758aa

Browse files
glaukiol1sbinet
andcommitted
Update os/os.module.go
Co-authored-by: Sebastien Binet <[email protected]>
1 parent f5c9943 commit 18758aa

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

os/os.module.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@ func chdir(self py.Object, args py.Tuple) (py.Object, error) {
7979
if len(args) == 0 {
8080
return nil, py.ExceptionNewf(py.TypeError, "Missing required argument 'path' (pos 1)")
8181
}
82-
if objectIsString(args[0]) {
82+
if !objectIsString(args[0]) {
83+
return nil, py.ExceptionNewf(py.TypeError, "str expected, not "+args[0].Type().Name)
84+
}
8385
dir, err := py.ReprAsString(args[0])
8486
if err != nil {
8587
return nil, py.ExceptionNewf(py.TypeError, "Failed to parse string") // never going to run

0 commit comments

Comments
 (0)