fix prop:custom-write printing on structure ports

When a `prop:custom-write` function prints to a given port for
recursive printing, don't reject a port that is a structure port.

Relevant to #1579
This commit is contained in:
Matthew Flatt 2017-01-27 18:04:20 -07:00
parent 03f2deeea9
commit aa130df8b2
2 changed files with 15 additions and 1 deletions

View File

@ -288,6 +288,20 @@
(define o (open-output-bytes))
(print ht o)))
;; ----------------------------------------
;; Check that recursive printing accepts a structure
;; with the `prop:output-port` property
(let ()
(struct p (out) #:property prop:output-port 0)
(struct s ()
#:property prop:custom-write
(lambda (v out mode)
(display "ok" (p out))))
(define o (open-output-bytes))
(write (s) (p o))
(test "ok" get-output-string o))
;; ----------------------------------------
(report-errs)

View File

@ -4235,7 +4235,7 @@ static Scheme_Object *custom_recur(int notdisplay, void *_vec, int argc, Scheme_
mz_jmp_buf escape, * volatile save;
volatile intptr_t save_max;
if (!SCHEME_OUTPORTP(argv[1])) {
if (!SCHEME_OUTPUT_PORTP(argv[1])) {
scheme_wrong_contract((notdisplay > 1)
? "print/recursive"
: (notdisplay ? "write/recursive" : "display/recursive"),