pprint issues infinite output for a protocol

Description

Using pprint with a protocol name generates an unending stream of output. pprint appears to recurse through the Var reference as the value of the :var key in the protocol definition itself.

To reproduce:

Approach: Add a dispatch method which doesn't deref the Var

Patch: CLJ-1565.patch
Screened by: Alex Miller

Environment

None

Activity

Show:
Andy Fingerhut
November 12, 2014, 7:26 PM

I've run across this issue while debugging Eastwood. It probably does more than what you want in terms of modifying pprint behavior, but check out eastwood.util/pprint-meta here: https://github.com/jonase/eastwood/blob/master/src/eastwood/util.clj#L206

Daniel Marjenburgh
November 12, 2014, 8:29 PM

The issue is that the simple-dispatch multifn dispatched a clojure.lang.Var to clojure.lang.IDeref, which dereferenced the Var before printing it. We have created a patch which dispatches a Var to the default print fn.

– With regards from the Amsterdam Clojure meetup group

Nicola Mometto
November 13, 2014, 1:13 AM

The patch for this ticket also addressed http://dev.clojure.org/jira/browse/CLJ-1576

Alex Miller
April 29, 2015, 5:28 PM

Patch needs a test.

Aspasia Beneti
May 1, 2015, 12:49 PM

I added a test to the fix. Not sure if it is the right place for the test, any feedback is welcome.

Completed

Assignee

Unassigned

Reporter

Michael Nygard

Labels

Approval

Ok

Patch

Code

Fix versions

Affects versions

Priority

Major