summaryrefslogtreecommitdiff
path: root/modules/language/python/exceptions.scm
diff options
context:
space:
mode:
Diffstat (limited to 'modules/language/python/exceptions.scm')
-rw-r--r--modules/language/python/exceptions.scm33
1 files changed, 25 insertions, 8 deletions
diff --git a/modules/language/python/exceptions.scm b/modules/language/python/exceptions.scm
index 87dd3c5..c1cad19 100644
--- a/modules/language/python/exceptions.scm
+++ b/modules/language/python/exceptions.scm
@@ -10,8 +10,8 @@
AssertionError ImportError
ModuleNotFoundError BlockingIOError
InterruptedError BaseException
- ZeroDivisionError
- OverflowError RecursionError
+ ZeroDivisionError PendingDeprecationWarning
+ OverflowError RecursionError RuntimeWarning
Warning DeprecationWarning BytesWarning
ResourceWarning UserWarning UnicodeTranslateError
UnicodeDecodeError LookupError IndentationError
@@ -20,7 +20,7 @@
FileExistsError FileNotFoundError IsADirectoryError
EnvironmentError ConnectionError NotADirectoryError
ConnectionResetError ChildProcessError TimeOutError
- BrokenPipeError ConnectionAbortedError
+ BrokenPipeError ConnectionAbortedError SystemExit
ConnectionRefusedError ArithmeticError))
(define-syntax-rule (aif it p x y) (let ((it p)) (if it x y)))
@@ -41,6 +41,22 @@
(format #f "~a"
(rawref self '__name__))))))
+(define-python-class SystemExit ()
+ (define __init__
+ (case-lambda
+ ((self)
+ (values))
+ ((self val . l)
+ (set self 'value val))))
+
+ (define __repr__
+ (lambda (self)
+ (aif it (rawref self 'value #f)
+ (format #f "~a:~a"
+ (rawref self '__name__) it)
+ (format #f "~a"
+ (rawref self '__name__))))))
+
(define-python-class Warning ()
(define __init__
(case-lambda
@@ -104,7 +120,6 @@
(define-er ArgumentError 'IndexError)
-
(define-er OSError 'OSError)
(define-python-class BlockingIOError (OSError))
(define-python-class ChildProcessError (OSError))
@@ -148,7 +163,9 @@
((_ nm w k)
(define-python-class nm w))))
-(define-wr BytesWarning 'BytesWarning)
-(define-wr DepricationWarning 'DeprecationWarning)
-(define-wr ResourceWarning 'ResourceWarning)
-(define-wr UserWarning 'UserWarning)
+(define-wr BytesWarning 'BytesWarning)
+(define-wr DepricationWarning 'DeprecationWarning)
+(define-wr ResourceWarning 'ResourceWarning)
+(define-wr UserWarning 'UserWarning)
+(define-wr PendingDeprecationWarning 'PendingDeprecationWarning)
+(define-wr RuntimeWarning 'RuntimeWarning)