A change in the optical polarization associated with a γ-ray flare in the blazar 3C279