with-redefs loses a Var's root binding if the Var is thread-bound

Description

When a Var has an in-thread binding and I use with-redefs to temporarily alter its root binding, the value restored to the root binding after with-redefs is finished will not be the original root value, but the thread-local one. The problem is using deref instead of something like clojure.lang.Var's .getRawRoot to backup the original root values in with-derefs-fn.

I have never used with-redefs and it is very unlikely that one would use it while the Vars in question are thread-bound. However, when reading the function's definition in Joy of Clojure and later in core.clj, I did not believe this behaviour was intended.

Environment

None

Attachments

2

Activity

Aaron Bedra 
July 11, 2012 at 12:53 AM

I paired with Gary on this and tested the patch on my machine after it was uploaded.

Completed

Details

Assignee

Reporter

Approval

Patch

Priority

Affects versions

Created March 28, 2012 at 5:05 PM
Updated July 20, 2012 at 10:44 PM
Resolved July 20, 2012 at 10:44 PM