Skip to content

Commit a12e575

Browse files
committed
Replace uncatchable (break ..) by (error ..) to support automatic build testing
1 parent d8f7a1c commit a12e575

20 files changed

+75
-76
lines changed

Diff for: compiler/compiler.lisp

+4-4
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@ an assigment statement. This changes at least the returned 'store' form.")
622622
(with-matching (ast ([module-stmt] ?suite))
623623
(multiple-value-bind (globals-ns globals-param)
624624
(typecase globals
625-
(symbol-hash-table (break "never"))
625+
(symbol-hash-table (error "never"))
626626
(eq-hash-table (values (make-hash-table-ns
627627
:dict-form '%exec-globals-ns
628628
:scope :exec-globals
@@ -639,7 +639,7 @@ an assigment statement. This changes at least the returned 'store' form.")
639639
globals)))
640640
(multiple-value-bind (locals-ns locals-param)
641641
(typecase locals
642-
(symbol-hash-table (break "never"))
642+
(symbol-hash-table (error "never"))
643643
(eq-hash-table (values (make-hash-table-w/excl-ns
644644
:dict-form '%exec-locals-ns
645645
:excluded-names locals-excluded-names
@@ -1467,7 +1467,7 @@ LOCALS shares share tail structure with input arg locals."
14671467
(defun in-module-1 (&rest args)
14681468
"Ensures the module exists"
14691469
(unless *load-truename*
1470-
(break "*LOAD-TRUENAME* is not set?!"))
1470+
(error "*LOAD-TRUENAME* is not set?!"))
14711471
(setf (gethash (derive-pathname *load-truename*) *load-file->module*)
14721472
(apply #'ensure-module args))
14731473
(unless *habitat*
@@ -1691,7 +1691,7 @@ LOCALS shares share tail structure with input arg locals."
16911691
;; ERROR does not support _classes_ as first condition argument; it
16921692
;; must be an _instance_ or condition type _name_.
16931693
(cond ((stringp (deproxy exc))
1694-
(break "String exceptions are not supported (got: ~S)" (deproxy exc))
1694+
(error "String exceptions are not supported (got: ~S)" (deproxy exc))
16951695
(py-raise '{TypeError}
16961696
"String exceptions are not supported (got: ~S)" (deproxy exc)))
16971697

Diff for: compiler/csetup.lisp

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
(signal (make-condition 'raise-syntax-error-please
3131
:syntax-error-args syntax-error-args))
3232
;; If no-one is listening (so not inside with-compiler-generated-syntax-errors)
33-
(break "Uncaught SyntaxError: ~A" (apply #'format nil syntax-error-args)))
33+
(error "Uncaught SyntaxError: ~A" (apply #'format nil syntax-error-args)))
3434

3535
(defmacro with-compiler-generated-syntax-errors (() &body body)
3636
`(handler-bind ((raise-syntax-error-please

Diff for: compiler/generator.lisp

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@
157157

158158
(defmacro %cps-convert (ast k &key nil-allowed)
159159
(cond ((and (null ast) (not nil-allowed))
160-
(break "%CPS-CONVERT of NIL (k=~S)" k))
160+
(error "%CPS-CONVERT of NIL (k=~S)" k))
161161
((null ast)
162162
`(funcall ,k ,ast))
163163
((listp ast)

Diff for: compiler/namespace.lisp

+4-4
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@
241241
when (member (car subnames) (cdr subnames))
242242
collect (car subnames) into dups
243243
finally (when dups
244-
(break "Namespace ~A contains duplicate names: ~A" ns dups)))
244+
(error "Namespace ~A contains duplicate names: ~A" ns dups)))
245245
`(let ,(ns.names ns)
246246
;; Python has no way to declare variables unused, so suppress those warnings.
247247
(declare (ignorable ,@(ns.names ns)))
@@ -284,7 +284,7 @@
284284
(defmethod ns.expand-with ((ns let-w/locals-ns) body-form environment)
285285
(declare (ignore environment))
286286
(whereas ((non-local-lets (set-difference (ns.let-names ns) (ns.names ns))))
287-
(break "Namespace ~A violates: ns.let-names <= ns.names: ~A." ns non-local-lets))
287+
(error "Namespace ~A violates: ns.let-names <= ns.names: ~A." ns non-local-lets))
288288
`(let ,(ns.let-names ns)
289289
;; Python has no way to declare variables unused, so suppress those warnings.
290290
(declare (ignorable ,@(ns.let-names ns)))
@@ -471,13 +471,13 @@
471471
(:method (environment)
472472
#+allegro (check-type environment sys::augmentable-environment)
473473
(get-module-namespace (or (get-pydecl :namespace environment)
474-
(break "Cannot determine module namespace: ~
474+
(error "Cannot determine module namespace: ~
475475
environment ~A has no namespace."
476476
environment))))
477477
(:method ((namespace namespace))
478478
(loop for ns = namespace then (ns.parent ns)
479479
while ns
480480
when (member (ns.scope ns) '(:module :exec-globals))
481481
return ns
482-
finally (break "No global namespace found among parents, for: ~A."
482+
finally (error "No global namespace found among parents, for: ~A."
483483
namespace))))

Diff for: contrib/executable.lisp

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
(defun command-line-args ()
1313
;; List of strings, first item = executable path
1414
#+sbcl cl-user::*POSIX-ARGV*
15-
#-sbcl (break "COMMAND-LINE-ARGS undefined in this implementation"))
15+
#-sbcl (error "COMMAND-LINE-ARGS undefined in this implementation"))
1616

1717
#+cmu
1818
(defun build-executable (&rest args)

Diff for: contrib/lispy.lisp

+5-5
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ Ends by signalling one of: %PARSE.FINISHED, %PARSE.SWITCH-LANGUAGE, %PARSE.UNEXP
8282
(when (>= *debug-recursion-count* 10)
8383
(check-type *lisp-standard-readtable* readtable)
8484
(setf *readtable* *lisp-standard-readtable*)
85-
(break "READ-LANGUAGE-FORMS: Too much recursion; *readtable* reset"))
85+
(error "READ-LANGUAGE-FORMS: Too much recursion; *readtable* reset"))
8686
(call-next-method)))
8787

8888
(defvar *lisp-readtable*)
@@ -165,7 +165,7 @@ Ends by signalling one of: %PARSE.FINISHED, %PARSE.SWITCH-LANGUAGE, %PARSE.UNEXP
165165
(when *lispy-debug*
166166
(format t "~&READ-LANGUAGE-FORMS :LISP says: reader-error: ~S" c))
167167
(error '%parse.switch-language :language :lisp :start-ix start-ix :reason c)))
168-
(break "never"))
168+
(error "never"))
169169

170170
(defun read-mixed-source-string (string &key lisp-readtable interactive-p)
171171
"Returns a list of Python and Lisp source elements, like: ((:lang form) (:lang2 form2) ..)
@@ -247,7 +247,7 @@ If INTERACTIVE-P then the last item is possibly (:lang :incomplete)"
247247
(declare (ignore c))
248248
(finish-parsing))))
249249
(read-language-forms language string start-ix :lisp-readtable lisp-readtable)
250-
(break "never"))))))))))
250+
(error "never"))))))))))
251251

252252
(defgeneric read-toplevel-forms (thing &key lisp-readtable))
253253

@@ -333,7 +333,7 @@ STREAM can be an interactive (REPL) stream"
333333
(format t "~& Input EOF reached~%")
334334
(setf eof-reached t))
335335
(when (and interactive-p (not (input-ends-with-newline input-string)))
336-
(break "READ-CHAR on interactive steam failed unexpectedly: last char was ~S but expected ~S."
336+
(error "READ-CHAR on interactive steam failed unexpectedly: last char was ~S but expected ~S."
337337
(when (plusp (length input-string))
338338
(aref input-string (1- (length input-string))))
339339
#\Newline))))
@@ -349,7 +349,7 @@ STREAM can be an interactive (REPL) stream"
349349
;; Should hold only during debugging of interactive parsing rules, e.g. by passing
350350
;; STRING-INPUT-STREAM but forcing :INTERACTIVE-P to T
351351
(unless *lispy-debug*
352-
(break "Unexpected: parsed-incomplete=~A interactive-p=~A eof-reached=~A"
352+
(error "Unexpected: parsed-incomplete=~A interactive-p=~A eof-reached=~A"
353353
parsed-incomplete interactive-p eof-reached)))
354354
(cond (parsed-incomplete
355355
(if (and interactive-p (not eof-reached))

Diff for: contrib/source.lisp

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
#-clpython-source-level-debugging
1616
(eval-when (:compile-toplevel :load-toplevel :execute)
17-
(break "This module is for Allegro 8.2+"))
17+
(error "This module is for Allegro 8.2+"))
1818

1919

2020
;;; The unit of source information is the SUBFORM, which links one Python AST node
@@ -170,7 +170,7 @@ Error when no table found."
170170
(eq (first src) 'defun)
171171
(eq (second src) module-func-name))
172172
do (or (find-it src)
173-
(break "Found DEFUN record but not :PYTHON-SOURCE-LOCATION-TABLE in src ~S for func ~S"
173+
(error "Found DEFUN record but not :PYTHON-SOURCE-LOCATION-TABLE in src ~S for func ~S"
174174
src module-func-name))
175175
finally (error "No Python source information found for module-function ~S." module-func-name))))
176176

@@ -277,7 +277,7 @@ The :PYTHON records are thus a subset of the :LISP records."
277277
(when (and (listp src)
278278
(eq (car src) 'defun))
279279
(return-from find (second src))))
280-
(break "no func for ix ~A" ix)))
280+
(error "no func for ix ~A" ix)))
281281
(sum-asm-ranges (vec start end)
282282
(loop with result
283283
for ix from start to end

Diff for: lib/_random.lisp

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import _random
3131
(check-type seed integer)
3232
;; http://www.franz.com/support/documentation/8.1/doc/implementation.htm#cl-random-2
3333
#+allegro (make-random-state t seed)
34-
#-allegro (break "Don't know how to create random-state with given seed ~
34+
#-allegro (error "Don't know how to create random-state with given seed ~
3535
in this Lisp implementation."))
3636

3737
(def-py-method |Random.seed| (x &optional n)

Diff for: lib/_socket.lisp

+26-26
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,20 @@
1717

1818
(defun |gethostname| ()
1919
#+allegro (excl.osi:gethostname)
20-
#-allegro (break "todo"))
20+
#-allegro (cl:error "todo"))
2121

2222
(defun |gethostbyaddr| (address)
2323
(check-type address string)
2424
(let* ((hostname #+allegro (if (socket:dotted-address-p address)
2525
(excl.osi:gethostbyaddr address)
2626
(excl.osi:gethostbyname address))
27-
#-allegro (break "todo"))
27+
#-allegro (cl:error "todo"))
2828
(alias-list (clpython:make-py-list-from-list ())) ;; todo
2929
(ip-addr-list (clpython:make-py-list-from-list (list #+allegro (socket:ipaddr-to-dotted (socket:lookup-hostname hostname))
30-
#-allegro (break "todo")))))
30+
#-allegro (cl:error "todo")))))
3131
(make-tuple-from-list (list hostname alias-list ip-addr-list)))
3232

33-
#-allegro (break "todo"))
33+
#-allegro (cl:error "todo"))
3434

3535

3636
;; Socket class
@@ -45,43 +45,43 @@
4545
"Socket")
4646

4747
(def-py-method |socket.close| (x)
48-
(break "todo"))
48+
(cl:error "todo"))
4949

5050
(def-py-method |socket.accept| (x)
5151
#+allegro (let* ((stream (socket:accept-connection (socket.socket x) :wait t))
5252
(remote-address (format nil "~A:~A" (socket:lookup-hostname (socket:remote-host stream)) (socket:remote-port stream))))
5353
(make-tuple-from-list (list (make-instance '|socket| :stream stream)
5454
remote-address)))
55-
#-allegro (break "todo"))
55+
#-allegro (cl:error "todo"))
5656

5757
(def-py-method |socket.bind| (x address)
5858
(setf (socket.address x) address))
5959

6060
(def-py-method |socket.connect| (x address)
61-
(break "todo"))
61+
(cl:error "todo"))
6262

6363
(def-py-method |socket.connect_ex| (x address)
64-
(break "todo"))
64+
(cl:error "todo"))
6565

6666
(def-py-method |socket.fileno| (x)
67-
(break "todo"))
67+
(cl:error "todo"))
6868

6969
(def-py-method |socket.getpeername| (x)
70-
(break "todo"))
70+
(cl:error "todo"))
7171

7272
(def-py-method |socket.getsockname| (x)
7373
(whereas ((socket (socket.socket x)))
7474
(let ((hostname #+allegro (socket:ipaddr-to-dotted (socket:local-host socket))
75-
#-allegro (break "todo"))
75+
#-allegro (error "todo"))
7676
(port #+allegro (socket:local-port socket)
77-
#-allegro (break "todo")))
77+
#-allegro (cl:error "todo")))
7878
(return-from |socket.getsockname|
7979
(make-tuple-from-list (list hostname port)))))
8080
;; default same as CPython does
8181
(make-tuple-from-list (list "0.0.0.0" 0)))
8282

8383
(def-py-method |socket.getsockopt| (x opt-name &optional buflen)
84-
(break "todo"))
84+
(cl:error "todo"))
8585

8686
(defparameter *all-sockets* ())
8787

@@ -92,51 +92,51 @@
9292
(integerp (second address)))
9393
(address) "Cannot socket.listen() without an address: ~S." address)
9494
(let ((socket #+allegro (socket:make-socket :connect :passive :local-port (+ (second address) (random 100))) ;; XXX random
95-
#-allegro (break "todo")))
95+
#-allegro (cl:error "todo")))
9696
(push socket *all-sockets*)
9797
(setf (socket.socket x) socket))))
9898

9999
(def-py-method |socket.makefile| (x &optional mode bufsize)
100-
(break "todo"))
100+
(cl:error "todo"))
101101

102102
(def-py-method |socket.recv| (x bufsize &optional flags)
103103
(unless (socket.stream x)
104-
(break "Can't socket.recv(): no socket stream."))
104+
(cl:error "Can't socket.recv(): no socket stream."))
105105
;; todo: multiple bytes
106106
(read-byte (socket.stream x)))
107107

108108
(def-py-method |socket.recvfrom| (x bufsize &optional flags)
109-
(break "todo"))
109+
(cl:error "todo"))
110110

111111
(def-py-method |socket.recvfrom_into| (x buffer &optional nbytes flags)
112-
(break "todo"))
112+
(cl:error "todo"))
113113

114114
(def-py-method |socket.recv_into| (x buffer &optional nbytes flags)
115-
(break "todo"))
115+
(cl:error "todo"))
116116

117117
(def-py-method |socket.send| (x string &optional flags)
118-
(break "todo"))
118+
(cl:error "todo"))
119119

120120
(def-py-method |socket.sendall| (x string &optional flags)
121-
(break "todo"))
121+
(cl:error "todo"))
122122

123123
(def-py-method |socket.sendto| (x string &optional flags address)
124-
(break "todo"))
124+
(cl:error "todo"))
125125

126126
(def-py-method |socket.setblocking| (x flag)
127-
(break "todo"))
127+
(cl:error "todo"))
128128

129129
(def-py-method |socket.settimeout| (x value)
130-
(break "todo"))
130+
(cl:error "todo"))
131131

132132
(def-py-method |socket.gettimeout| (x)
133-
(break "todo"))
133+
(cl:error "todo"))
134134

135135
(def-py-method |socket.setsockopt| (x level optname value)
136136
(warn "socket.setsockopt(..) ignored"))
137137

138138
(def-py-method |socket.shutdown| (x how)
139-
(break "todo"))
139+
(cl:error "todo"))
140140

141141

142142
;;; Constants

Diff for: lib/imp.lisp

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515

1616
(defun |find_module| (name path)
1717
(declare (ignore name path))
18-
(break "Todo: imp.find_module()"))
18+
(error "Todo: imp.find_module()"))
1919

2020
(defun |load_module| (&rest args)
2121
(declare (ignore args))
22-
(break "Todo: imp.load_module()"))
22+
(error "Todo: imp.load_module()"))
2323

2424
;; imp.PY_SOURCE
2525
;; imp.PY_COMPILED

Diff for: lib/operator.lisp

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@
2424
(with-standard-io-syntax
2525
(let ((name (format nil "~A-~A" '#:py op)))
2626
(or (find-symbol name :clpython)
27-
(break "No such symbol in pkg clpython: ~A" name)))))
27+
(error "No such symbol in pkg clpython: ~A" name)))))
2828

2929
(defun sym->iop (op)
3030
(with-standard-io-syntax
3131
(let ((name (format nil "~A-~A=" '#:py op)))
3232
(or (find-symbol name :clpython)
33-
(break "No such symbol in pkg clpython: ~A" name)))))
33+
(error "No such symbol in pkg clpython: ~A" name)))))
3434

3535
(defmacro def-magic-twins (name params &body body)
3636
`(progn (defun ,name ,params ,@body)

Diff for: lib/thread.lisp

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
(:process-lock (values 'allegro-process-lock
5050
(list :process-lock (mp:make-process-lock :name (format nil "lock ~A" id))))))
5151
(apply #'make-instance type :id id :wait-msg wait-msg args))
52-
#-allegro (break "todo")))
52+
#-allegro (error "todo")))
5353

5454
(def-py-method |lock.acquire| (x &optional (waitflag 1))
5555
(let ((wait (ecase waitflag

Diff for: parser/lexer.lisp

+1-1
Original file line numberDiff line numberDiff line change
@@ -943,4 +943,4 @@ Returns NEWLINE-P, NEW-INDENT, EOF-P."
943943
(if clpython:*exceptions-loaded*
944944
(funcall 'clpython:py-raise '{UnexpectedEofError} msg)
945945
(raise-syntax-error msg)))
946-
(break "unreachable"))
946+
(error "unreachable"))

Diff for: parser/pprint.lisp

+1-1
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ output to a string does not start with a newline."
240240
(items-s (mapcar (lambda (x) (format nil "~A" x)) items)))
241241

242242
(with-standard-io-syntax
243-
(break "body-s: ~S item-s: ~S" body-s items-s))
243+
(warn "body-s: ~S item-s: ~S" body-s items-s))
244244

245245
;; standard syntax, otherwise strings are
246246
;; printed with Python string escapes

Diff for: parser/walk.lisp

+2-2
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ CLASSDEF, FUNCDEF or LAMBDA."
7676
(when *walk-debug*
7777
(warn "w> ~A" ast))
7878
(unless ast
79-
(break "Attempt to WALK-PY-AST into an AST that is NIL"))
79+
(error "Attempt to WALK-PY-AST into an AST that is NIL"))
8080

8181
;; Call user function on whole form. The returned values
8282
;; control how we proceed.
@@ -253,7 +253,7 @@ CLASSDEF, FUNCDEF or LAMBDA."
253253

254254
(defun ast-recurse-fun (f ast &key value target)
255255
(when (null ast)
256-
(break "AST-RECURSE-FUN got NIL"))
256+
(error "AST-RECURSE-FUN got NIL"))
257257

258258
(unless (consp ast)
259259
(return-from ast-recurse-fun ast))

0 commit comments

Comments
 (0)