:eof option in clojure.core/read not handled properly

Description

Example form which exhibits the behavior:

(read {:read-cond :allow :eof (Object.)} input)

When EOF is reached in the stream, instead of returning the :eof value specified the boolean value true is always returned instead. If you omit :eof from the option map given to clojure.core/read, false is consistently returned and no EOF error is thrown.
Patch: 0001-CLJ-1685-correctly-handle-eof-option-in-read-read-st-v2.patch

Note: Currently

1 (read {} stream)

behaves like

1 (read {:eof nil} stream)

rather than

1 (read stream)

, the proposed patch makes it believe like

1 (read {:eof :eofthrow} input)

, the proposed patch changes this so that the default behaviour is always to throw on eof unless a :eof option is explicitly included in the read opts.

Patch: clj-1685-v3.patch

Screened by: Alex Miller

Environment

None

Status

Assignee

Alex Miller

Reporter

Adrian Medina

Labels

Approval

Ok

Patch

Code and Test

Fix versions

Affects versions

Release 1.7

Priority

Major
Configure