Example at the top of page 162 of this book needs to be updated.
He gives some sage code, then claims "which yields a^2 + 1." as output. But the output is 0 (if you try it), and it's very obvious it should be 0 if you just think about what it's doing (so definitely not a bug). Then he claims "Careful: sage is not perfect, and if you change QQ above the ZZ, sage doesn’t seem to be able to give the correct answer (as of the time these notes were written).". That also works fine.