diff options
Diffstat (limited to 'modules/language/python/module/os.scm')
-rw-r--r-- | modules/language/python/module/os.scm | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/modules/language/python/module/os.scm b/modules/language/python/module/os.scm index e4dc72c..764c701 100644 --- a/modules/language/python/module/os.scm +++ b/modules/language/python/module/os.scm @@ -114,6 +114,8 @@ RTLD_NOLOAD RTLD_DEEPBIND getrandom urandom GRND_NONBLOCK GRND_RANDOM + + sys )) (define supports_dir_fd @@ -135,7 +137,14 @@ (define-syntax-rule (ca code) (catch #t (lambda () code) - (lambda x (raise error x)))) + (lambda x + (match x + (('system-error x _ _ (17)) + (raise (FileExistsError x))) + (('system-error x _ _ (2)) + (raise (FileNotFoundError x))) + (x (raise error x)))))) + (define-syntax-rule (rm code) (let ((r (ca code))) (if (< r 0) @@ -442,7 +451,7 @@ (define close (lambda (fd) - (ca ((@ (guile) close-fdes) fd)))) + (ca ((@ (guile) close) fd)))) (define (closerange fd_low fd_high) (for ((i : (range fd_low fd_high))) () @@ -2363,3 +2372,5 @@ p) (py-list l))) +(define-python-class sys () + (define platform "posix")) |