diff --git a/src/code/reader.lisp b/src/code/reader.lisp index b06230ce2306b498425046af9b4b2e85894f2abb..996b1f3feb22777de3af1c29612499b3dd27b32a 100644 --- a/src/code/reader.lisp +++ b/src/code/reader.lisp @@ -62,8 +62,11 @@ (reader-error-format-arguments condition)) nil error-stream (file-position error-stream))) + (format t "open-stream-p ~A~%" (open-stream-p error-stream)) (format stream (intl:gettext "Reader error ~@[at ~D ~]on ~S:~%~?") - (file-position error-stream) error-stream + (and (open-stream-p error-stream) + (file-position error-stream)) + error-stream (reader-error-format-control condition) (reader-error-format-arguments condition)))))) diff --git a/src/general-info/release-20f.txt b/src/general-info/release-20f.txt index b6ce0d516cd7de783e3b157279e6df5b991eef85..388ca02f797e5e9909c85722252a59012e93be70 100644 --- a/src/general-info/release-20f.txt +++ b/src/general-info/release-20f.txt @@ -109,6 +109,7 @@ New in this release: * Ticket #101, item 1 fixed. * Ticket #105, fixed. * Ticket #84 fixed on x86. + * Ticket #105 fixed. * Other changes: diff --git a/tests/trac.lisp b/tests/trac.lisp index 9a02189f97d3988956c50325c8915ccd970c2340..571b0691d1ca534a5c62af0fba96927c6a2e3be0 100644 --- a/tests/trac.lisp +++ b/tests/trac.lisp @@ -366,4 +366,33 @@ (assert-error 'reader-error (read-from-string ".1e-45")) (assert-error 'reader-error (read-from-string "1d-324")) (assert-error 'reader-error (read-from-string "1w-324"))) + +(defun read-string-fn (str) + (handler-case + (let ((acc nil)) + (with-input-from-string + (stream str) + (loop do + (let* ((eof-marker (cons nil nil)) + (elem (read stream nil eof-marker))) + (if (eq elem eof-marker) + (loop-finish) + (push elem acc))))) + (setq acc (nreverse acc)) + (values :OK acc)) + (error (condition) + (return-from read-string-fn + (values :ERROR (format nil "~A" condition)))) + (storage-condition (condition) + (return-from read-string-fn + (values :STORAGE (format nil "~A" condition)))))) + +(define-test trac.105 + (:tag :trac) + (assert-equal (values :ERROR + "Reader error on #<String-Input Stream>: +No dispatch function defined for #\\W.") + (read-string-fn "#\wtf"))) + + \ No newline at end of file