Re-open #4140 (reverted in #4292). The original patch was merged a bit too eagerly. It should go in _after_ 2.0 is released with some confidence.