After gameObject rotation is set, it changes to a different value

I am setting the rotation of a game object in some part of the code, as follows:

gameObject.transform.rotation = q1

where q1 is a quaternion with the new rotation I want for this game object. Immediately after the rotation is set to q1, the game object transform appears to be set correctly. I confirm this eg. via Debug.Log before I exit that function in my code. In the next Update call for this game object, I obtain the rotation and it’s not what I set it to, but it’s set to another value - say q2. The game object does not have a rigidbody attached to it. I have debugged my code and it does not set the rotation to q2. Is it likely the change to q2 is normal unity behaviour - and if so, how can I find out about where the object transform is set to q2.

I don’t know much about Quaternions, but maybe the Transform.rotation property does something to q1 when you set it, like clamp its angles? If you want the exact value of your quaternion to stay the same, maybe you could have a private Quaternion in your script, and set transform.rotation every update.