From 9faac297a083fbc59011e54ca6ccdc8c611e7ffb Mon Sep 17 00:00:00 2001 From: Christophe Rhodes Date: Fri, 2 Sep 2005 20:44:06 +0000 Subject: [PATCH] 0.9.4.24: Make printing HASH-TABLEs with *READ-EVAL* = NIL signal PRINT-NOT-READABLE. --- NEWS | 3 +++ src/code/target-hash-table.lisp | 4 +--- tests/print.impure.lisp | 10 ++++++++++ version.lisp-expr | 2 +- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 882bbad..b8a17a2 100644 --- a/NEWS +++ b/NEWS @@ -17,6 +17,9 @@ changes in sbcl-0.9.5 relative to sbcl-0.9.4: Linux kernels >= 2.6.12 that interfere with SBCL's memory maps. This workaround will only be in effect on systems with the proc filesystem mounted. + * bug fix: printing objects of type HASH-TABLE signals a + PRINT-NOT-READABLE error when *READ-EVAL* is NIL. (reported by + Faré Rideau) * threads ** bug fix: parent thread now can be gc'ed even with a live child thread diff --git a/src/code/target-hash-table.lisp b/src/code/target-hash-table.lisp index 138d39e..b98c33d 100644 --- a/src/code/target-hash-table.lisp +++ b/src/code/target-hash-table.lisp @@ -721,14 +721,12 @@ (def!method print-object ((hash-table hash-table) stream) (declare (type stream stream)) - (cond ((not *print-readably*) + (cond ((or (not *print-readably*) (not *read-eval*)) (print-unreadable-object (hash-table stream :type t :identity t) (format stream ":TEST ~S :COUNT ~S" (hash-table-test hash-table) (hash-table-count hash-table)))) - ((not *read-eval*) - (error "can't print hash tables readably without *READ-EVAL*")) (t (with-standard-io-syntax (format stream diff --git a/tests/print.impure.lisp b/tests/print.impure.lisp index 8d22b9d..a54996e 100644 --- a/tests/print.impure.lisp +++ b/tests/print.impure.lisp @@ -337,4 +337,14 @@ ;;; Adam Warner's test case (assert (string= (format nil "~@F" 1.23) "+1.23")) +(let ((table (make-hash-table))) + (setf (gethash 1 table) t) + (assert + (raises-error? (with-standard-io-syntax + (let ((*read-eval* nil) + (*print-readably* t)) + (with-output-to-string (*standard-output*) + (prin1 table)))) + print-not-readable))) + ;;; success diff --git a/version.lisp-expr b/version.lisp-expr index 3f50e67..221fa69 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -17,4 +17,4 @@ ;;; checkins which aren't released. (And occasionally for internal ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"0.9.4.23" +"0.9.4.24" -- 1.7.10.4