#342: missing default method for gray-streams:stream-finish-output ------------------------+----------------------- Reporter: avodonosov | Owner: Type: defect | Status: new Priority: major | Milestone: Component: streams | Version: 1.3.0-dev Keywords: | ------------------------+----------------------- Test case:
{{{ (ql:quickload :flexi-streams)
(let* ((binary-stream (flexi-streams:make-in-memory-output-stream))) (finish-output binary-stream))
The value #<FLEXI-STREAMS::VECTOR-OUTPUT-STREAM {1E566F3}> is not of type #<STANDARD-CLASS FLEXI-STREAMS:FLEXI-OUTPUT-STREAM {7D84CE}>. [Condition of type SIMPLE-TYPE-ERROR]
Backtrace: 0: (#<FUNCTION {1C9E6C0}> #<SIMPLE-TYPE-ERROR {FC82A6}> #<FUNCTION {1C9E6C0}>) 1: (APPLY #<FUNCTION {1C9E6C0}> (#<SIMPLE-TYPE-ERROR {FC82A6}> #<FUNCTION {1C9E6C0}>)) 2: (SYSTEM::RUN-HOOK SYSTEM::*INVOKE-DEBUGGER-HOOK* #<SIMPLE-TYPE-ERROR {FC82A6}> #<FUNCTION {1C9E6C0}>) 3: (INVOKE-DEBUGGER #<SIMPLE-TYPE-ERROR {FC82A6}>) 4: (GRAY-STREAMS:STREAM-FINISH-OUTPUT #<FLEXI-STREAMS::VECTOR-OUTPUT- STREAM {1E566F3}>) 5: (SYSTEM::%FINISH-OUTPUT #<FLEXI-STREAMS::VECTOR-OUTPUT-STREAM {1E566F3}>) 6: (FINISH-OUTPUT #<FLEXI-STREAMS::VECTOR-OUTPUT-STREAM {1E566F3}>)
}}}
This happens because there is no default method for stream-finish-output. According to the Gray proposal, default method should exist and do nothing.
The fix: {{{ Index: src/org/armedbear/lisp/gray-streams.lisp =================================================================== --- src/org/armedbear/lisp/gray-streams.lisp (revision 14464) +++ src/org/armedbear/lisp/gray-streams.lisp (working copy) @@ -314,6 +314,10 @@ (declare (ignore stream)) nil)
+(defmethod stream-finish-output (stream) + (declare (ignore stream)) + nil) + (defmethod stream-clear-output (stream) (declare (ignore stream)) nil) }}}
Also, ABCL handles the absence of default method not very correctly. It should signal "no applicable method". What happens here is that flexi- streams overrides stream-finish-output for one of its classes - FLEXI-STREAMS:FLEXI-OUTPUT- STREAM. So, I think ABCL sees that there is only one variant of method, and tries to apply this method, despite we pass object of another class. And here typecast happen.
-- Ticket URL: http://abcl.org/trac/ticket/342 armedbear http://abcl.org armedbear